*.h和*.m文件中的两个接口

Ily*_*lin 4 cocoa-touch objective-c ios class-extensions

对不起我的英语,让我的心说话:)在我工作的一个项目中,我注意到了一个有趣的时刻.

在*.h文件中声明的接口:

@interface FrontViewController : UIViewController
...
@end
Run Code Online (Sandbox Code Playgroud)

在*.m文件中我找到了另一个界面.

@interface FrontViewController()

// Private Properties:
@property (retain, nonatomic) UIPanGestureRecognizer *navigationBarPanGestureRecognizer;

// Private Methods:
- (IBAction)pushExample:(id)sender;

@end

@implementation FrontViewController
...
@end
Run Code Online (Sandbox Code Playgroud)

为什么需要?那有什么意义呢? - 我认为这是为了方便.是?

edc*_*591 6

这是一个类扩展.它通常用于声明类的私有方法和属性.

在这里阅读它.