Book Image

Application Development in iOS 7

By : Kyle Begeman
Book Image

Application Development in iOS 7

By: Kyle Begeman

Overview of this book

Table of Contents (15 chapters)
Application Development in iOS 7
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up button actions


Our final step before applying our Auto Layout constraints is to connect our buttons to the class, using an IBAction for each button. While MenuViewController is selected, open the assistant editor from the toolbar and make sure you select the header file (MenuViewController.h).

While holding down the control key on your keyboard, click on and drag the My Foods button into the header file. Position your mouse between @interface and @end and release the mouse once you see a small popup that says Inset Outlet, Action, or Outlet Collection. In the new view that pops up, select Action from the Connection drop-down menu, and name this action myFoodsPressed. Lastly, select the Type drop-down option, and select UIButton. Repeat this process for Add New with an action name addNewPressed.

Your header file should now look like the following code snippet:

#import <UIKit/UIKit.h>

@interface MenuViewController : UIViewController

- (IBAction)myFoodsPressed:(UIButton *)sender...