小编Ash*_*han的帖子

在iOS8 Swift中更改UINavigationBar标题

我以编程方式在我的Superview中添加了UINavigationBar,名为BaseViewController,它继承了UIViewController.但是当我尝试为UINavigationBar设置标题时.我收到称为致命错误的错误:无法解包Optional.None

以下是我的快速课程.如何解包和更改UINavigationBar标题

import UIKit

class BaseViewConroller: UIViewController {
    var navBar:UINavigationBar=UINavigationBar()

    override func viewDidLoad() {
        super.viewDidLoad()
        setNavBarToTheView()
        // Do any additional setup after loading the view.
        navBar.topItem.title="test test"
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func setNavBarToTheView()
    {
        navBar.frame=CGRectMake(0, 0, 320, 50)
        navBar.backgroundColor=(UIColor .blackColor())
        self.view .addSubview(navBar)
    }

}
Run Code Online (Sandbox Code Playgroud)

uinavigationbar swift ios8

8
推荐指数
1
解决办法
2万
查看次数

使用蓝牙将文件传输到另一台iOS设备

有没有办法以编程方式使用蓝牙将文件从一个iOS设备发送到另一个设备.我使用过Air Drop,但似乎无法在iOS中找到适合蓝牙文件传输的代码片段.

bluetooth objective-c file-transfer ios

0
推荐指数
1
解决办法
3174
查看次数