iPhone Application Development All-in-One 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.

































































































































































































































ClassDelegate(s) ProtocolSpecial Use
ABPeoplePickerNavigationController

ABNewPersonViewController

ABNewPersonViewController

ABUnknownPersonViewController
ABPeoplePickerNavigationControllerDelegate

ABNewPersonViewControllerDelegate

ABNewPersonViewControllerDelegate

ABUnknownPersonViewControllerDelegate

AVAudioRecorderAVAudioRecorderDelegate
AVAudioSessionAVAudioSessionDelegate
CAAnimationNone
CAAnimationGroupNone
CALayerNone
CLLocationManagerCLLocationManagerDelegate
EAAccessoryEAAccessoryDelegate
GKSessionGKSessionDelegate
GKPeerPickerControllerGKPeerPickerControllerDelegate
NSErrorNSErrorRecoveryAttempting
MKMapViewMKAnnotation

MKMapViewDelegate
MkReverseGeocoderMKReverseGeocoderDelegate
NSNetService

NSNetServiceBrowser
NSNetServiceDelegate

NSNetServiceBrowserDelegate

NSStreamNSStreamDelegate
NSPort

NSMachPort
NSPortDelegate

NSMachPortDelegate

NSFetchedResultsControllerNSFetchedResultsControllerDelegate
NSKeyedArchiver

NSKeyedUnarchiver
NSKeyedArchiverDelegate

NSKeyedUnarchiverDelegate

NSURLConnectionNone
MFMailComposeViewControllerMFMailComposeViewControllerDelegate
SKRequest

SKProductsRequest
SKRequestDelegate

SKProductsRequestDelegate

UIAccelerometerUIAccelerometerDelegate
UIActionSheetUIActionSheetDelegate
UIAlertViewUIAlertViewDelegate
UIApplicationUIApplicationDelegateAlso used for push notifications
UIImagePickerUIImagePickerControllerDelegate
UINavigationBarUINavigationBarDelegateTo push or pop view controllers
UIPickerViewUIPickerViewDataSource

UIPickerViewDelegate
UIResponderUIResponderStandardEditActionsSupport for Copy, Paste, and Select
UIScrollViewUIScrollViewDelegateUnder some circumstances
UISearchDisplayControllerUISearchDisplayDelegate
UISearchBarUISearchBarDelegate
UITabBarUITabBarControllerDelegateTo customize a tab bar
UITableViewUITableViewDataSource

UITableViewDelegate
UITextFieldUITextFieldDelegateTo put away the keyboard
UITextViewUITextViewDelegateTo examine text being edited
UISearchBarUISearchBarDelegate
UIWebViewUIWebViewDelegate
MPMediaPickerControllerMPMediaPickerControllerDelegate
NSXMLParserNSXMLParserDelegate




>



>


>


Using Objective-C Operators


Objective-C operators, like those in other programming languages, let you perform operations on variables (hence the name). Objective-C provides many operators, and keeping track of all of them can be difficult as you program your iPhone app. Use the following tables to jog your memory as to which operator accomplishes what task.





























Arithmetic Operators
OperatorWhat It Does
+Addition
-Subtraction
*Multiplication
/Division
%Modulo
































Relational and Equality Operators
OperatorWhat It Does
==Equal to
!=Not equal to
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to




















Logical Operators
OperatorWhat It Does
!NOT
&&Logical AND
||Logical OR
















































Compound Assignment Operators
OperatorWhat It Does
+=Addition
-=Subtraction
*=Multiplication
\/=Division
\%=Modulo
&=Bitwise AND
|=Bitwise Inclusive OR
^=Exclusive OR
<<=Shift Left
>>=Shift Right
















































Increment and Decrement Operators
OperatorWhat It Does
++Addition
--Subtraction
*=Multiplication
/=Division
%=Modulo
&=Bitwise AND
|=Bitwise Inclusive OR
^=Exclusive OR
<<=Shift Left
>>=Shift Right
































Bitwise Operators
OperatorWhat It Does
&Bitwise AND
|Bitwise Inclusive OR
^Exclusive OR
~Unary complement (bit inversion)
<<Shift Left
>>Shift Right
































Other operators
OperatorWhat It Does
()Cast
,Comma
Sizeof()Size of
? :Conditional
&Address
*Indirection




>






>
dummies


Source:http://www.dummies.com/how-to/content/iphone-application-development-allinone-for-dummie.html

No comments:

Post a Comment