开发者

Do you need to release an @property?

开发者 https://www.devze.com 2023-02-25 12:29 出处:网络
Do you need to @property (nonatomic, assign) int var开发者_如何学Ciable; in the .m file? If not, is there a reason why you don\'t need to release it?Yes, there\'s a good reason not to release it - it\

Do you need to @property (nonatomic, assign) int var开发者_如何学Ciable; in the .m file? If not, is there a reason why you don't need to release it?


Yes, there's a good reason not to release it - it's not an object. And you should use @synthesize in your implementation (.m), and @property in your interface (.h).

Apple's The Objective-C Programming Language is a great place to find answers to questions like this.


You need to release only those variable that you allocated or used.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号