Cheat Sheet

iOS 6 Application Development For Dummies

From iOS 6 Application Development For Dummies by Neal Goldstein, Dave Wilson

The UIKit framework provides a lot of your iOS application’s basic functionality. As you develop your iOS app, you customize the UIKit framework by using subclassing, Target-Action, and delegation, but one challenge facing new developers is determining which of these mechanisms to use. This cheat sheet can help you decide.

When to Use Subclassing in iOS 6 App Development

Subclassing allows you to customize behaviors while you're developing your iOS application. Keep the following points about subclassing in mind as you develop your app:

  • In the first stage, you create a new class, called a subclass, that inherits properties from another (super) class

  • In the second stage, you add properties as needed for your iOS application.

  • In general, you'll want to subclass the following

    • UIView, to create your (more complex) content views, which you may fill with controls, graphics, and so on.

    • UIViewController, to manage the content views and connect them to the model.

    • NSObject, to create Model views and delegates.

Knowing the Target-Action Patterns for iOS 6 App Development

Following are the Target-Action patterns that you use when programming iOS applications. Specify the target as the view controller (which you'll have already subclassed).

  • UITabBarItem (for items on the tab bar)

  • UIBarButtonItem (for items on the Navigation bar and toolbar)

  • UIButton

  • UIDatePicker

  • UIPageControl

  • UISegmentedControl

  • UITextField

  • UISlider

  • UISwitch

Building iOS 6 Apps Using Delegates with Views and Other Classes

The following table includes delegates used in iOS application development. Exceptions to when you need to use a delegate are shown in the Special Use column.

Class Delegate(s) Protocol Special Use
ABPeoplePickerNavigation
Controller
ABNewPersonView
Controller
ABNewPersonView
Controller
ABUnknownPersonView
Controller
ABPeoplePickerNavigationControllerDelegate
ABNewPersonViewControllerDelegate
ABNewPersonViewControllerDelegate
ABUnknownPersonViewControllerDelegate
AVAudioRecorder AVAudioRecorderDelegate
AVAudioSession AVAudioSessionDelegate
CAAnimation None
CAAnimationGroup None
CALayer None
CLLocationManager CLLocationManagerDelegate
EAAccessory EAAccessoryDelegate
GKGameCenterView
Controller
GKGameCenterControllerDelegate The delegate is called when the player dismisses the Game Center user interface. New to iOS 6.
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
UICollectionView
UINavigationBar UINavigationBarDelegate To push or pop view controllers
UIPickerView UIPickerViewDataSource
UIPickerViewDelegate
UIResponder UIResponderStandardEditActions Support for Copy, Paste, and Select
UIScrollView UIScrollViewDelegate Under some circumstances
UIScrollViewAccessibilityDelegate Methods you can implement to provide accessibility information for a Scroll view. New to iOS 6.
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 UISearchBarDelegate
UIWebView UIWebViewDelegate
MPMediaPickerController MPMediaPickerControllerDelegate
NSXMLParser NSXMLParserDelegate

Using Objective-C Operators in iOS 6 App Development

Objective-C has many helpful operators for your iOS programming. Use the following table to jog your memory about which operator you should use to accomplish a certain task.

Arithmetic Operators
Operator What It Does
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo
Relational and Equality Operators
Operator What It Does
== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Logical Operators
Operator What It Does
! NOT
&& Logical AND
|| Logical OR
Compound Assignment Operators
Operator What It Does
+= Addition
-= Subtraction
*= Multiplication
\/= Division
\%= Modulo
&= Bitwise AND
|= Bitwise Inclusive OR
^= Exclusive OR
<<= Shift Left
>>= Shift Right
Increment and Decrement Operators
Operator What It Does
++ Addition
-- Subtraction
*= Multiplication
/= Division
%= Modulo
&= Bitwise AND
|= Bitwise Inclusive OR
^= Exclusive OR
<<= Shift Left
>>= Shift Right
Bitwise Operators
Operator What It Does
& Bitwise AND
| Bitwise Inclusive OR
^ Exclusive OR
~ Unary complement (bit inversion)
<< Shift Left
>> Shift Right
Other Operators
Operator What It Does
() Cast
, Comma
Sizeof() Size of
? : Conditional
& Address
* Indirection
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.