NevzatR
NevzatR

Reputation: 245

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

Upvotes: 11

Views: 13991

Answers (1)

saadnib
saadnib

Reputation: 11145

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

Swift 3:

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

Upvotes: 37

Related Questions