UIButton touch up inside event hook up in coding phase?

后端 未结 1 1368
生来不讨喜
生来不讨喜 2021-02-14 03:40

I create a UIButton in coding phase and never use Interface Builder so how can I call touch up inside event to hook up with any method in coding phase?

相关标签:
1条回答
  • 2021-02-14 04:13
    [button addTarget:self action:@selector(BtnPressed:) forControlEvents:UIControlEventTouchUpInside];
    

    Swift 3:

    button.addTarget(self, action: #selector(ViewControllerName.BtnPressed), for: .touchUpInside)
    
    0 讨论(0)
提交回复
热议问题