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 section includes delegates used in iOS application development. Exceptions to when you need to use a delegate are shown in italics in the Delegate Protocol column.

ClassDelegate(s)
Protocol
ABPeoplePicker
NavigationController


ABNewPersonView
Controller

ABNewPersonView
Controller

ABUnknownPerson
ViewController
ABPeoplePicker
Navigation
ControllerDelegate

ABNewPersonView
ControllerDelegate

ABNewPersonView
ControllerDelegate

ABUnknownPerson
ViewController
Delegate
AVAudioRecorder AVAudioRecorder
Delegate
AVAudioSession AVAudioSession
Delegate
CAAnimation None
CAAnimationGroup None
CALayer None
CLLocationManager CLLocation
ManagerDelegate
EAAccessory EAAccessory
Delegate
GKGameCenterView
Controller
GKGameCenter
ControllerDelegate

The delegate is
called when the player
dis
misses the Game
Center user interface.
New to iOS 6.
GKSession GKSessionDelegate
GKPeerPickerController GKPeerPicker
ControllerDelegate
NSError NSErrorRecovery
Attempting
MKMapView MKAnnotation
  MKMapView
Delegate
MkReverseGeocoder MKReverse
GeocoderDelegate
NSNetService


NSNetServiceBrowser
NSNetService
Delegate

NSNetService
BrowserDelegate
NSStream NSStreamDelegate
NSPort

NSMachPort
NSPortDelegate

NSMachPort
Delegate
NSFetchedResults
Controller
NSFetchedResults
ControllerDelegate
NSKeyedArchiver

NSKeyedUnarchiver
NSKeyedArchiver
Delegate

NSKeyedUnarchiver
Delegate
NSURLConnection None
MFMailComposeView
Controller
MFMailCompose
ViewController
Delegate
SKRequest

SKProductsRequest
SKRequestDelegate

SKProductsRequest
Delegate
UIAccelerometer UIAccelerometer
Delegate
UIActionSheet UIActionSheet
Delegate
UIAlertView UIAlertView
Delegate
UIApplication UIApplication
Delegate

Also used for push
notifications
UIImagePicker UIImagePicker
ControllerDelegate
UICollectionView  
UINavigationBar UINavigationBar
Delegate

To push or pop view
controllers
UIPickerView UIPickerViewData
Source
  UIPickerView
Delegate
UIResponder UIResponder
StandardEditActions

Support for Copy,
Paste, and Select
UIScrollView UIScrollView
Delegate

Under some
circumstances
  UIScrollView
Accessibility
Delegate

Methods you can
implement to provide
accessibility infor
-
mation for a Scroll
view. New to iOS 6.
UISearchDisplay
Controller
UISearchDisplay
Delegate
UISearchBar UISearchBar
Delegate
UITabBar UITabBarController
Delegate

To customize a tab bar
UITableView UITableView
DataSource
  UITableView
Delegate
UITextField UITextFieldDelegate

To put away the
keyboard
UITextView UITextViewDelegate

To examine text
being edited
UISearchBar UISearchBar
Delegate
UIWebView UIWebViewDelegate
MPMediaPicker
Controller
MPMediaPicker
ControllerDelegate
NSXMLParser NSXMLParser
Delegate

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

Recommends

Promoted Stories From Around The Web

blog comments powered by Disqus