When is @property and @synthesize needed?

后端 未结 4 580
时光取名叫无心
时光取名叫无心 2021-01-03 16:38

When exactly do I have to add @property (nonatomic, retain) and @synthesize? Also, when is declaring IBOutlet someObject enough? How i

4条回答
  •  感情败类
    2021-01-03 17:41

    The pair (@property, @synthesize) will create the set/get methods used for accessing your ivars from other objects.

    In a usual view controller you don't need to define properties for your IBOutlets since they should normally only be accessed by the view controller they belong to.

提交回复
热议问题