Learn Object C(1) Learn Objective-C in Day 6 - 1 ~ 3
Implementation
#import "Car.h"
@implementation Car
- (void) addGas {
}
@end
Classes from Apple
NS is abbreviation for NextStep.
NSString ? ? immutable string
NSMutableString ? ? ?mutable string
NSArray ? ? ?immutable array
NSMutableArray ? ? ? mutable array
NSNumber
Pointers and Initializing
File --> New Project ---> Mac OS X--> Application ---> Command Line Tool ----> Type: Foundation
#import <Foundation/Foundation.h>
int main(int argc, constchar * argv[]) {???
NSString *testString; ? ? ? ? ? ? ? ? ?
//pointer to NSString???
testString = [[NSString?alloc] init]; ?
//have instance of NSString???
testString = @"sillycat test String"; ?
//@ a sign of NSString???
NSLog(@"only string= %@",testString); ?
//%@ means an Objetive-C object???
return?0;
}
Inheritance
NSObject ---> NSString ----> NSMutableString
? ? ? ? ? ? ? ?---> NSArray -----> NSMutableArray
? ? ? ? ? ? ? ?---> NSValue -----> NSNumber
References:
http://www.otierney.net/objective-c.html.zh-tw.big5
http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html
http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/Introduction.html
http://mobile.tutsplus.com/tutorials/iphone/learn-objective-c-day-1/
http://mobile.tutsplus.com/tutorials/iphone/learn-objective-c-2/
http://mobile.tutsplus.com/tutorials/iphone/learn-objective-c-day-3/
http://mobile.tutsplus.com/tutorials/iphone/learn-objective-c-day-4/
Objective C Book from Apple
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html