What is the correct way to create a custom setter for a weak property in Objective C?

后端 未结 1 923
灰色年华
灰色年华 2020-12-18 20:00

If I declare a property like this:

@property(nonatomic,weak) Foo *someProperty;

and I then declare a custom setter like so:



        
相关标签:
1条回答
  • 2020-12-18 20:48

    Yes, that's all there is to it. Of course you can specify a custom iVar if you'd like something other than _someProperty like:

    @synthesize someProperty = someProperty_;
    
    0 讨论(0)
提交回复
热议问题