Cheat Sheet
iPhone Application Development For Dummies
The UIKit framework provides a great deal of your iPhone application’s basic functionality. As you develop your iPhone app, you customize the behavior of the UIKit framework by using subclassing, target-action, and delegation, but one challenge facing new developers is determining which of these mechanisms to use when. These tips can help you decide:
When to Use Subclassing in iPhone App Development
Subclassing is one of the mechanisms you use to customize behaviors while you're developing your iPhone application. Subclassing involves two stages: (1) creating a new class, called a subclass, that inherits properties from another (super) class and then (2) adding properties as needed for your iPhone application. In general, you’ll want to subclass
UIView, to create your (more complex) content views, which you may fill with controls, graphics, or the like.
UIViewController, to manage the content views and connect it to the model.
NSObject, to create Model views and delegates.
Knowing the Target-Action Patterns for iPhone App Development
Following are the Target-Action patterns that you use when programming iPhone applications. You generally will specify the target as the view controller (which you’ll have already subclassed) because it controls the view in which these controls reside.
UITabBarItem (for items on the tab bar)
UIBarButtonItem (for items on the navigation bar and tool bar)
UIButton
UIDatePicker
UIPageControl
UISegmentedControl
UITextField
UISlider
UISwitch
Using Delegates with Views and Other Classes
When you create iPhone applications, you use delegates to implement application-specific behavior for generic views or classes. The table includes all known available delegates used in iPhone application development, though others may be possible. Exceptions to when you need to use a delegate are shown in the Special Use column.
| Class | Delegate(s) Protocol | Special Use |
|---|---|---|
| ABPeoplePickerNavigationController ABNewPersonViewController ABNewPersonViewController ABUnknownPersonViewController |
ABPeoplePickerNavigationControllerDelegate ABNewPersonViewControllerDelegate ABNewPersonViewControllerDelegate ABUnknownPersonViewControllerDelegate |
|
| AVAudioRecorder | AVAudioRecorderDelegate | |
| AVAudioSession | AVAudioSessionDelegate | |
| CAAnimation | None | |
| CAAnimationGroup | None | |
| CALayer | None | |
| CLLocationManager | CLLocationManagerDelegate | |
| EAAccessory | EAAccessoryDelegate | |
| GKSession | GKSessionDelegate | |
| GKPeerPickerController | GKPeerPickerControllerDelegate | |
| NSError | NSErrorRecoveryAttempting | |
| MKMapView | MKAnnotation | |
| MKMapViewDelegate | ||
| MkReverseGeocoder | MKReverseGeocoderDelegate | |
| NSNetService NSNetServiceBrowser |
NSNetServiceDelegate NSNetServiceBrowserDelegate |
|
| NSStream | NSStreamDelegate | |
| NSPort NSMachPort |
NSPortDelegate NSMachPortDelegate |
|
| NSFetchedResultsController | NSFetchedResultsControllerDelegate | |
| NSKeyedArchiver NSKeyedUnarchiver |
NSKeyedArchiverDelegate NSKeyedUnarchiverDelegate |
|
| NSURLConnection | None | |
| MFMailComposeViewController | MFMailComposeViewControllerDelegate | |
| SKRequest SKProductsRequest |
SKRequestDelegate SKProductsRequestDelegate |
|
| UIAccelerometer | UIAccelerometerDelegate | |
| UIActionSheet | UIActionSheetDelegate | |
| UIAlertView | UIAlertViewDelegate | |
| UIApplication | UIApplicationDelegate | Also used for push notifications |
| UIImagePicker | UIImagePickerControllerDelegate | |
| UINavigationBar | UINavigationBarDelegate | To push or pop view controllers |
| UIPickerView | UIPickerViewDataSource | |
| UIPickerViewDelegate | ||
| UIResponder | UIResponderStandardEditActions | Support for Copy, Paste, and Select |
| UIScrollView | UIScrollViewDelegate | Under some circumstances |
| UISearchDisplayController | UISearchDisplayDelegate | |
| UISearchBar | UISearchBarDelegate | |
| UITabBar | UITabBarControllerDelegate | To customize a tab bar |
| UITableView | UITableViewDataSource | |
| UITableViewDelegate | ||
| UITextField | UITextFieldDelegate | To put away the keyboard |
| UITextView | UITextViewDelegate | To examine text being edited |
| UISearchBar | UISearhBarDelegate | |
| UIWebView | UIWebViewDelegate | |
| MPMediaPickerController | MPMediaPickerControllerDelegate | |
| NSXMLParser | NSXMLParserDelegate |
More Series
- Java For Dummies Cheat Sheet
- C++ All-In-One For Dummies Cheat Sheet
- SQL All-in-One Cheat Sheet
- C++ for Dummies Cheat Sheet
- HTML, XHTML, and CSS All-in-One For Dummies Cheat Sheet
- ASP.NET 3.5 For Dummies Cheat Sheet
- Windows PowerShell 2 For Dummies Cheat Sheet
- Beginning Programming with Java For Dummies Cheat Sheet
- PHP & MySQL For Dummies Cheat Sheet















Comments (0)
Leave a Reply