2020-03-09

2020-03-17  本文已影响0人  Im_Free

分类:

Category
Category 是表示一个指向分类的结构体的指针,其定义如下:
typedef struct objc_category *Category;
struct objc_category {
  char *category_name                          OBJC2_UNAVAILABLE; // 分类名
  char *class_name                             OBJC2_UNAVAILABLE; // 分类所属的类名
  struct objc_method_list *instance_methods    OBJC2_UNAVAILABLE; // 实例方法列表
  struct objc_method_list *class_methods       OBJC2_UNAVAILABLE; // 类方法列表
  struct objc_protocol_list *protocols         OBJC2_UNAVAILABLE; // 分类所实现的协议列表
}

扩展:

添加私有属性,

@interface XXX ()
//编译时期添加**私有**属性、方法
//私有方法(如果不实现,编译时会报警,Method definition for 'XXX' not found)
@end

KVO

KVC

https://www.jianshu.com/p/b9f020a8b4c9

上一篇 下一篇

猜你喜欢

热点阅读