Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton touch up inside event hook up in coding phase?

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

like image 626
NevzatR Avatar asked Mar 31 '11 07:03

NevzatR


1 Answers

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

Swift 3:

button.addTarget(self, action: #selector(ViewControllerName.BtnPressed), for: .touchUpInside)
like image 189
saadnib Avatar answered Jan 02 '23 19:01

saadnib