开发者

UIButton addTarget:action:ForControlEvents not working

开发者 https://www.devze.com 2023-01-26 18:16 出处:网络
i am getting a view out of a nib like so: NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@\"PostitView\" owner:self options:nil];

i am getting a view out of a nib like so:

NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"PostitView" owner:self options:nil];
viewPostit = [nib objectAtIndex:0];

then I add the following to it:

[viewPostit.btnAction addT开发者_如何学Pythonarget:self action:@selector(btnSavePostitClicked:) forControlEvents:UIControlEventTouchUpInside];

The view and all the other controls I add custom properties to works perfectly. But when I click that button, no event gets triggered and I dont know why.

Any suggestions what I am doing wrong?

-(void) btnSavePostitClicked:(id)sender
{}

Thank you

Tom


Have you linked btnAction in IB ?

0

精彩评论

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