@property修饰符

  • 修饰是否生成getter方法的
    • readonly 只生成setter方法,不生成getter方法
    • readwrite 既生成getter 又生成setter方法(默认)
@property (readonly) int age;
  • 指定所生成的方法的方法名称
  1. getter=你定制的getter方法名称
  2. setter=你定义的setter方法名称(注意setter方法必须要有 :)
@property (getter=isMarried)  BOOL  married;
说明,通常BOOL类型的属性的getter方法要以is开头

 

相关文章:

  • 2022-12-23
  • 2021-08-14
  • 2021-11-29
  • 2021-11-17
  • 2022-12-23
  • 2021-11-27
  • 2021-06-12
猜你喜欢
  • 2021-05-30
  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案