鍍金池/ 問(wèn)答/iOS  HTML/ 為什么有的時(shí)候故事版與代碼無(wú)法關(guān)聯(lián)?

為什么有的時(shí)候故事版與代碼無(wú)法關(guān)聯(lián)?

Storyboard中按住ctrl鍵拖動(dòng)至代碼區(qū),沒(méi)有自動(dòng)彈出@IBAOutlet以及選擇和命名的窗口。

class ViewController: UIViewController{
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    //設(shè)置導(dǎo)航欄圖片
 self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: "Background"), for: UIBarMetrics.default)
    
     override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
回答
編輯回答
心悲涼

原來(lái)是沒(méi)有命名Storybord里的ViewController.

2018年3月22日 01:43
編輯回答
念舊

如果無(wú)法顯示窗口, 在Class和ViewDidLoad之間加一空行, 然后拖動(dòng)到空行上.

2018年7月9日 05:39