How to use addTarget method in swift 3

后端 未结 10 1402
清酒与你
清酒与你 2020-11-29 02:20

here is my button object

    let loginRegisterButton:UIButton = {
    let button = UIButton(type: .system)
    button.backgroundColor = UIColor         


        
10条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 02:55

    Instead of

    let loginRegisterButton:UIButton = {
    //...  }()
    

    Try:

    lazy var loginRegisterButton:UIButton = {
    //...  }()
    

    That should fix the compile error!!!

提交回复
热议问题