Sometimes when all you need is a simple UI application that doesn't require too much customization or skinning, you can try building the application in Interface Builder.
Step 1: Create a New Project (Apple+Shift+N) >
View-Based Application, name the application
IBTestStep 2: Edit the default
IBTestViewController.h & .m files
. Add the following lines in the appropriate places:
IBOutlet UIButton* button; IBOutlet UILabel* label; - (IBAction)userPressedButton:(id)sender;
Step 3: Open MainWindow.xib w/ Interface Builder
Step 4: Double-Click Test View Controller and a window will pop up
Step 5a: Add a View (from the library: APPLE+L) to Test View Controller
Step 5b: Add a Rounded Rect Button to the View you just added
Step 5c: Add a Label to the View you just added
Step 6: Link your UIButton & UILabel to the button and label you just added. You can do this by
Apple+Right-Clicking the Rounded Rect Button & drag your mouse onto the Test View Controller
Step 7: Select userPressedButton in the popup
Done... your code is now hooked up through the interface builder. When users click the button, your userPressedButtons method will fire, as expected.
No comments:
Post a Comment