我只是不明白为什么有些人声明.m文件中的方法。不能这些声明只是在.h文件中?下面是我所看到的主要是:声明.h文件和.m文件中指定@interface和@end的方法之间的区别
//myClass.h
#import <UIKit/UIKit.h>
@interface myClass: UIViewController
{
}
@end
和执行(.M)部分:
//myClass.m
#import "myClass.h"
@interface myClass
//declare some methods here
@end
@implementation myClass
//the actual implementation
@end
有当方法被声明为这种方式有什么区别?另外,“@private”方法可以在myClass.h中声明,不是吗?
([在h和m文件@interface定义之间的差异]的可能重复http://stackoverflow.com/questions/3967187/difference-between-interface-definition-in-h-and-m-file ) –