天天看點

Objective-C初步研究 - 實作檔案(Implementation File)

1. 實作檔案以.m為字尾名

Objective-C初步研究 - 實作檔案(Implementation File)

#import “myClass.h”

導入頭檔案

@implementation myClass

告訴編譯器實作哪個類

@synthesize myLabel;

為執行個體變量産生getters和setters方法

類方法實作

+(NSString)myClassMethod:(NSString)aString {

 // Implement the Class Method Here!

}

執行個體方法實作

-(NSString)myInstanceMethod:(NSString)aString  anotherParameter:(NSURL)aURL {

 // Implement the Instance Method Here!

最後必須以@end結尾

繼續閱讀