对不起我的英语,让我发自内心的说吧:) 在我工作的一个项目中,我注意到一个有趣的时刻。
在*.h文件中声明接口(interface):
@interface FrontViewController : UIViewController
...
@end
在 *.m 文件中我找到了另一个接口(interface)。
@interface FrontViewController()
// Private Properties:
@property (retain, nonatomic) UIPanGestureRecognizer *navigationBarPanGestureRecognizer;
// Private Methods:
- (IBAction)pushExample:(id)sender;
@end
@implementation FrontViewController
...
@end
为什么需要它?这有什么意义呢? -我认为这是为了方便。是吗?
最佳答案
这是一个类扩展。它通常用于声明类的私有(private)方法和属性。
了解它 here .
关于objective-c - *.h 和 *.m 文件中的两个接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9590917/