I am building an app with interface builder for the iPad. The scroll view takes up most of the screen except for a small portion at the bottom. Scrolling is enabled downwards. In the small portion on the bottom (not inside the scrollview), there is a UIButton that is connected to an IBAction:
- (IBAction)submit:(id)sender;
And implemented as follows:
- (IBAction)submit:(id)sender
{
NSLog(@"submit called");
}
I have connected up IBActions to buttons in IB countless times and never had a problem... But for some reason this is not getting called. I hooked it up by selecting the Button->connections inspector -> touch up inside -> files owner -> submit... Has anyone had this problem?
“IBAction” is used by in place of the “return type” void for a method that receives an event sent from Interface Builder. The IBAction keyword allows the programmer to connect the source code to user interface objects in Interface Builder.
An IBOutlet is for hooking up a property to a view when designing your XIB. An IBAction is for hooking a method (action) up to a view when designing your XIB. An IBOutlet lets you reference the view from your controller code.
@IBAction is similar to @IBOutlet , but goes the other way: @IBOutlet is a way of connecting code to storyboard layouts, and @IBAction is a way of making storyboard layouts trigger code. This method takes one parameter, called sender . It's of type UIButton because we know that's what will be calling the method.
IBAction – a special method triggered by user-interface objects. Interface Builder recognizes them. @interface Controller { IBOutlet id textField; // links to TextField UI object } - (IBAction)doAction:(id)sender; // e.g. called when button pushed.
Check Whether:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With