Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 9. Utility Applications > SUMMARY - Pg. 224

224 CHAPTER 9 UTILITY APPLICATIONS - (void)addCountryViewControllerDidFinish: (AddCountryViewController *)controller; When the user presses the Done button in this view, you invoke the done: method: //---invokes the method defined in the protocol--- - (IBAction)done { [self.delegate addCountryViewControllerDidFinish:self]; } In the FlipsideViewController.m fi le, you need to implement the protocol defi ned in the additional view, which is AddCountryViewControllerDelegate : //---implements the AddCountryViewControllerDelegate protocol--- @interface FlipsideViewController : UIViewController <AddCountryViewControllerDelegate> { Specifically, you need to implement the addCountryViewControllerDidFinish: method, which dismisses the view controller: //---defines the addCountryViewControllerDidFinish: method--- - (void)addCountryViewControllerDidFinish: (AddCountryViewController *)controller { [self dismissModalViewControllerAnimated:YES]; } Finally, you defi ne the add: method, which shows the additional view using the vertical transition: //---defines the add: action--- - (IBAction)add { AddCountryViewController *controller = [[AddCountryViewController alloc] initWithNibName:@"AddCountryView" bundle:nil]; controller.delegate = self; //---use the vertical transition--- controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:controller animated:YES]; [controller release]; } SUMMARY In this chapter, you saw the Utility Application template provided by the iPhone SDK to help developers create Utility Applications. Understanding how the transitioning between the Views works is important because it allows you to extend the template for your custom use. In Chapter 10, you will see how Utility Applications are often used together with application settings to persist users' preferences and data.