2017-06-15 15 views
0

當我啓動應用程序,我看到一個白色的屏幕,並告訴我這個錯誤,我該如何解決它?出現在此行中的錯誤:當我啓動應用程序時,我看到一個白色的屏幕,並告訴我這個錯誤,我該如何解決它?

[myLabel.alpha = 0]

錯誤是線程1:EXC_BAD_INSTRUCTION(代碼= EXC_I386_INVOP,subcode0x0)

import UIKit 

class ViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 
      myLabel.alpha = 0 
    } 

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

你在哪裏聲明瞭myLabel? –

+0

@IBOutlet weak var myLabel:UILabel! 在這一行中,它位於括號內 – Ludo7

+0

您是否檢查過它的輸出是否正確?檢查IBOutlet與接口生成器連接 –

回答

2

你@IBOutlet必須已成爲無效。也許你在連接它或其他原因後重命名它。您應該刪除現有的並重新創建。
請檢查my answer in other thread on how to do this

+0

如果這解決了您的問題,請接受答案。 – Lucy

相關問題