开发者

iphone basic release question

开发者 https://www.devze.com 2022-12-21 16:40 出处:网络
When i add a new subview, i cant immediately release the controller after displaying. How should i release this viewController?

When i add a new subview, i cant immediately release the controller after displaying. How should i release this viewController?

I was thinking about using a property for the viewController, and use delegation to notify for removing the view and releasing it?

Is this the best way to do it? or should i d开发者_开发百科o something with autorelease?

Ton.


I'm going to have a shot at answering this rather vague question. I think what you are doing is creating a new subview and then releasing it. What you need to do is add it to your main view. Something like:

[myView addSubview.newSubview];

Once you have done this myView owns the subview and you can release it without hassles.

0

精彩评论

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