Is a synthesized property already alloc/init -ed?

后端 未结 3 1849
旧巷少年郎
旧巷少年郎 2021-01-02 17:19

If I have a custom NSObject class called ProgramModel, does it get alloc/init -ed when I @property and @synthesize it from another cla

3条回答
  •  自闭症患者
    2021-01-02 18:10

    By default, all instance variables are zero'd out. In the case of objects, that means they're nil. If you want an initial value in the property, you need to put it there during your initializer/viewDidLoad method.

提交回复
热议问题