当property遇上category

  @property可以在类定义中,以及extension定义中使用,编译器会自动为@property生成代码,并在变量列表(ivar_list_t)中添加相应的以下划线开头的变量。

  在category中,编译器允许定义@property,但不会为此@property生成代码,也即意味着编译器不会在变量列表中加入property的变量。必须人工的实现property的方法。

  当property遇上category

参考:https://developer.apple.com/library/mac/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html

相关文章:

  • 2021-08-26
  • 2021-07-15
  • 2022-02-22
  • 2021-09-27
  • 2021-11-01
  • 2021-05-29
猜你喜欢
  • 2021-04-20
  • 2021-10-30
  • 2021-07-16
  • 2022-01-04
  • 2021-07-09
  • 2021-08-24
  • 2021-05-15
相关资源
相似解决方案