alloc + init with synthesized property - does it cause retain count to increase by two?

前端 未结 4 931
生来不讨喜
生来不讨喜 2021-02-05 10:23

I\'ve seeen the following snippet quite a bit:

In the header:

SomeClass *bla;
@property(nonatomic,retain) SomeClass *bla;

In the implem

4条回答
  •  清歌不尽
    2021-02-05 10:41

    There is no double count. The setter created by by synthesize does a release before doing a retain. See Stanford class on objective c class 3 as referenced on the apple website. It is also worth noting that in case of iboutlets the alloc init is not needed as it is performed through loading of the xib file

提交回复
热议问题