views:

20

answers:

2

Hi All

I am trying to hook up a UIButton to a IBAction in interface builder but IB will not show the method that I defined as an option to hook it up to.

- (IBAction)someAction:(id)sender;

That is what I have in the h file, and then in the M file I have

- (IBAction)someAction:(id)sender{
NSLog(@"Button Tapped.");   }

The IB Document is connected to that class i know because that class also has a UIPicker, and that connects fine.

Any help would be brilliant on this,

Thanks, Callaghan001.

A: 

Make sure you're actually wiring up the handler for the button's event (probably touch up inside) and not the button itself. So instead of dragging directly from the button, either ctrl-click the button to see its connections and drag from its touch up inside event to the target, or ctrl-click the target, find the action, and drag from that to the button. If the action doesn't show up on the target in these cases, and you're sure interface builder knows what class it is, then I'm baffled.

zem
No I am using the touch up inside option, and it is still not showing up. Its really annoying. I have seen this before once after I updated xcode the last time and eventually it just started working again for no reason, but its just frustrating.
Callaghan001
then i'm baffled. aside from the obvious "solutions," like restarting xcode/interface builder, which i assume you've already tried.
zem
Just tried a restart and cleared the PRAM of the machine and finally it is working now with no change to the code. The mind boggles as to why it wasn't working in the first place.
Callaghan001
A: 

I sink your implementation mast be

  • (void)someAction:(id)sender { NSLog(@"Button Tapped.");
    }
No IBAction will work too, I fixed it with w reset of the PRAM, will keep an eye on it, hopefully it wont keep happening.
Callaghan001