November 2013
Beginner
325 pages
9h 47m
English
A button works using target-action, like you learned about in Chapter 27. The button’s action is the message that you want sent when the button is tapped. The button’s target is the object to which that message should be sent.
In BNRAppDelegate.m, give the Insert button a target-action pair:
#pragma mark - Application delegate callbacks
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Create and configure a rounded rect Insert button
self.insertButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
self.insertButton.frame = buttonFrame;
// Give the button a title
[self.insertButton setTitle:@"Insert"
forState:UIControlStateNormal];
// ...Read now
Unlock full access