iOS property declaration clarification

前端 未结 5 1710
春和景丽
春和景丽 2020-12-22 18:24

This is a two part question in hopes that I can understand more about the topic.

1) It seems to me that you have two popular optio

5条回答
  •  醉梦人生
    2020-12-22 18:57

    First one will be private declaration and will not be accessible by other classes if you do not define the second one. Second is used together with @synthesize in .m module , and setter/getter's are created for you by the compiler. You can still define your own getter or setter with this. In this case all iVars defined in @property can be accessed by other classes.Retain/release operations are done automatically. You should read Apple documentation for more details. please check: What's the difference between the atomic and nonatomic attributes?

提交回复
热议问题