Reputation: 1336
How do I connect a button added in Interface Builder to an action? This is what my instructions for adding a forum component in to my app. It says "Connect the action of that button to your "launchSatisfactionRemoteComponent:" method in IB." This would need to happen in my "Support.xib" window. Where is the code where you connect the action to that?
Upvotes: 15
Views: 35754
Reputation: 983
In your code, add the method to handle that action. For instance,
.h file
- (IBAction)buttonTapped:(UIButton *)sender;
.m file
- (IBAction)buttonTapped:(UIButton *)sender
{
NSLog(@"Button Tapped!");
}
Now, open you xib file, right click to File's Owner, there you should see your method, drag the plus circle onto your button. You should see a bunch of different actions, most of the time touchUpInside is what you are looking for.
Upvotes: 26