简体   繁体   English

iPhone基本发布问题

[英]iphone basic release question

When i add a new subview, i cant immediately release the controller after displaying. 添加新的子视图时,显示后无法立即释放控制器。 How should i release this viewController? 我应该如何释放此viewController?

I was thinking about using a property for the viewController, and use delegation to notify for removing the view and releasing it? 我正在考虑为viewController使用属性,并使用委托来通知删除视图并释放它?

Is this the best way to do it? 这是最好的方法吗? or should i do 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. 完成此操作后,myView将拥有该子视图,并且可以轻松释放它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM