views:

54

answers:

1

Hello,

I have a toolbar, in which is placed a UIBarButtonItem. The selector is targeted at a custom view of mine; a method with this signature:

-(IBAction)pop{code}

However, clicking it does not cause any action to occur. The buttonitem doesn't appear to respond to the click either, it just stays gray.

Linking a UIButton's TouchUpInside event to the pop method is fine, it operates the method and displays the popover. But as soon as I connect the BarButtonItem's selector to it instead, it stops responding.

+1  A: 

Make sure the selector has no colon after it - @selector(pop). If you use @selector(pop:) it expects a (void)pop:(id)sender { ... } function.

Hiltmon
I've tried it both ways. I'm actually hooking it up via IB, so it automatically changes to add the colon either way. Either way, I get zilch! :(
mtc06
Try "Build/Clean", usually fixes IB issues. If not, try removing the button from the View. Also check that your File's Owner class is YOUR view controller class.
Hiltmon
Ah. File's Owner might be the source. I'll check, thanks for the tip.
mtc06
I've accepted this answer because it's a common gotcha. Mine was a far more stupid result - I've overriden the hittest method for another reason. It was making attempts at touching the taskbar fall through. Silly me.
mtc06