开发者

UIButton touch up inside event hook up in coding phase?

开发者 https://www.devze.com 2023-02-20 18:26 出处:网络
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??[button addTarget:self action:@se

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??


[button addTarget:self action:@selector(BtnPressed:) forControlEvents:UIControlEventTouchUpInside];

Swift 3:

button.addTarget(self, action: #selector(ViewControllerName.BtnPressed), for: .touchUpInside)
0

精彩评论

暂无评论...
验证码 换一张
取 消