Storyboard中按住ctrl键拖动至代码区,没有自动弹出@IBAOutlet以及选择和命名的窗口。
class ViewController: UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
//设置导航栏图片
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: "Background"), for: UIBarMetrics.default)
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
原来是没有命名Storybord里的ViewController.