Objective c 头文件中有两个接口
我在研究一些代码,发现了一些我不太理解的东西。类的.h文件有两个定义如下的接口Objective c 头文件中有两个接口,objective-c,interface,header-files,Objective C,Interface,Header Files,我在研究一些代码,发现了一些我不太理解的东西。类的.h文件有两个定义如下的接口 @interface ClassInterface : UIViewController // Some properties @end @interface ClassInterface (FileOpen) // Some methods @end 在头文件中定义接口的目的是什么 FileOpen用于什么 第一个提到的只是属性和方法的声明部分。在头文件中定义接口的目的是我们可以轻松地与导入其他类或访问
@interface ClassInterface : UIViewController
// Some properties
@end
@interface ClassInterface (FileOpen)
// Some methods
@end
FileOpen
用于什么李>
第一个提到的只是属性和方法的声明部分。在头文件中定义接口的目的是我们可以轻松地与导入其他类或访问属性进行通信
@interface ClassInterface : UIViewController
// Some properties
@end
第二个是category
,用于使用其他方法扩展类。FileOpen
用于使用类中的某些方法扩展类类别,#pragma mark
在Objective-C中互换使用,作为头文件/实现文件中代码组之间的参数。