Best way to set a retained property to a newly created object

前端 未结 4 1830
南笙
南笙 2021-01-05 22:21

Which is the best way to handle creating an object to live in a retained property? I\'ve included several examples.

Assume the property is:

@property         


        
4条回答
  •  执笔经年
    2021-01-05 22:27

    self.myProperty = [[MyClass alloc] init];
    

    Use ARC to generate your releases and retains at compile time.

提交回复
热议问题