2011年12月25日 星期日

Cocoa fundamental

Application class
- NSObject: root class of all object
Methods: alloc, dealloc, init
- UIApplication: superclass of every app
- UIWindow: container of view(s)
- UIView
- UIResponder
- UIConrol: superclass of all screen control like buttons, text field, etc

Data type class
- NSString/NSMutableString (mutable means can be changed later)
MyLabel=@"hello world"

- NSArray/NSMutableArray
Mymessage=[[NSArray alloc] initWithObjects: @"good", @"bad", nil];

- NSDictionary/NSMutableDictionary (=hashtable in java)
Mymessage=[[NSDictionary alloc] initWithObjectsAndKeys:@"good",@"first",@"bad",@"second",nil];
First -> good
Second -> bad
To retrieve,
Message=[Mymessage objectForKey:@"first"]

- NSNumber/NSDecimalNumber
- NSDate
- NSURL

Interface class
UILabel
UIButton
UISwitch
UISegmentedControl like switch
UISlider
UITextField/ UITextView (textfield/textarea)
UIDatePicker/UIPicker

XCode > Help > Developer documentation
Quick help: hold down option and double click a symbol in XCode

沒有留言:

張貼留言