【发布时间】:2011-11-19 18:18:12
【问题描述】:
我只是不明白为什么有些人在 .m 文件中声明方法。这些声明不能直接放在 .h 文件中吗?以下是我看到的主要内容:
//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 本身中声明,不是吗?
【问题讨论】:
标签: iphone objective-c