我只是不明白爲什麼有些人聲明.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 ) –