I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file.
When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside' event it doesn't respond.
Other events don't work either. 'Touch Drag Enter', 'Touch Drag Exit', 'Touch Up Outside' etc. Only Touch Down.
Does anyone have any idea why this might be?
Rich
First, I can absolutely, positively guarantee you that UIButtons correctly connected in IB responds as expected to touch-up-inside events. (Can you imagine if they didn't?!)
Given that, it's a fair bet that you have not hooked things up as you expect. Here are some things to try:
Make your action print a log statement first thing:
NSLog(@"%s", __PRETTY_FUNCTION__);
Check in IB that the ONLY function that your button is wired to is your touch-up-inside action. (Later, you can wire it to multiple events but, for testing, we want to simplify as much as possible.)
Make sure you have the correct signature for your action:
- (IBAction) myButtonPressedAction: (id) sender;
Just to be sure everything's clean, delete the button from your .xib and re-add it.
userInteractionEnabled
set.If none of that helps, you'll have to tell us more about the problem area. Perhaps add a screenshot of your button setup in IB and code snippets from your project.