objective-c的基本知识 时间:2016-02-14 08:17:09 【文件属性】: 文件名称:objective-c的基本知识 文件大小:48KB 文件格式:DOCX 更新时间:2016-02-14 08:17:09 objective-c 类别(Category) Category是ObjC语言中的扩展机制之一,另一个为Protocol。 Category提供一种为某个类添加方法而又不必编写子类的途径。 假设有这样一个类CarInfo: #import @interface CarInfo : NSObject { } -(void)sayCarBrand; @end @implementation CarInfo -(void) sayCarBrand{ NSLog(@"Car brand: Golf"); } @end 立即下载