2017-03-03 101 views
-3

我连接了UILabelUIButton,但仍然中止。请帮我解决这个问题。为什么这会在UIlabel上放弃?

import UIKit 

class ViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     counterLabel.text = "0" 
     // Do any additional setup after loading the view, typically from a nib. 
    } 
    var counterNum: Int = 0 

    @IBOutlet weak var counterLabel: UILabel! 

    @IBAction func Tap(_ sender: UIButton) { 

     self.counterNum += 1 
     self.counterLabel.text = String(self.counterNum) 
    } 
} 
+3

究竟是什么问题?你有没有崩溃日志? – Larme

+1

为什么包含'func didReceiveMemoryWarning'?请仅为您的问题添加_relevant_代码。 –

+0

当它中止时,Xcode会显示什么? –

回答

0

请检查您的出口连接在您的故事板counterLabel。看起来你忘了做插座连接。

+0

它说Tread1:signal SIGABRT –