简体   繁体   中英

UIButton on static cell not calling action

I added a button to a section of a static cell on my storyboard, and hooked up an action by control dragging.

So I end up with what looks like the right code in the .h

- (IBAction)picker:(id)sender;

and then in the .m

- (IBAction)picker:(id)sender { NSLog(@"picker"); }

But for some reason the action doesn't get called.

I can add a button programatically to the view and get that to call the action. But why isn't the button action working when configured in IB? I'm guessing something to do with using static cells but I can't figure it out.

OK - seems to be a problem with using UIControlEventTouchDown vs UIControlEventTouchUpInside

Where UIControlEventTouchDown is working and UIControlEventTouchUpInside is not for some reason.

I have no idea why :-)

When I defined the button programmatically I noticed that I'd copy and pasted code that was using UIControlEventTouchDown, and thats why it was working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM