Objective-C初步研究 - 实现文件(Implementation File)

1. 实现文件以.m为后缀名

 

 

#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结尾

转载于:https://www.cnblogs.com/davidgu/archive/2012/05/21/2511514.html

猜你喜欢

转载自blog.csdn.net/weixin_33674437/article/details/93802787
今日推荐