Objective-C Memory Question

后端 未结 6 631
感动是毒
感动是毒 2021-01-23 07:45

Is it a leak if I have a view controller and allocate the view like this:

self.view = [[UIView alloc] initWithFrame:frame];

Do I need to do som

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-23 08:15

    This depends on the declaration of the view property. If it's not a (retain) property, then you're fine. If it is a retaining property, you must call release.

提交回复
热议问题