不再在ios6中调用viewDidUnload [英] viewDidUnload no longer called in ios6

查看:125
本文介绍了不再在ios6中调用viewDidUnload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了新版本的Xcode / ios6。 viewDidUnload现已折旧。

I just installed the new version of Xcode/ios6. viewDidUnload is now depreciated.

在苹果文档中,


viewDidUnload [。 ..]在iOS 6.0中不推荐使用。在低内存条件下不再清除视图,因此永远不会调用此方法。

viewDidUnload [...] Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.

但是应用程序的数量正在使用此回调来释放他们的属性,例如:

But numbers of apps are using this callback to release their properties, like :

- (void)viewDidUnload {
    [super viewDidUnload];

    self.recipientButton = nil;
    self.connectButton = nil;
    self.infoLabel = nil;
}

这是发布IBOutlets的最佳做法。

This was the best practice to release your IBOutlets.

所以,第一个问题:

iOS 6中这些现有应用会发生什么?它们会泄漏吗?

So, first question:
What is going to happen these existing apps in iOS 6? Will they leak ?

和第二个:

发布IBOutlet属性的新推荐方法是什么?在dealloc方法中?

and second one:
What is the new recommended way to release an IBOutlet property ? In dealloc method ?

推荐答案

对于第一个问题:

您的ViewController将收到didReceiveMemoryWarning方法回调,你可以忽略视图&此方法中的其他组件

Your ViewController will receive didReceiveMemoryWarning method callback and you can nil out the view & other components in this method

参考请参阅WWDC 2012视频会话,了解EVOLLUTION OF VIEW CONTROLLER,如果您还没有(我相信它们仅适用于注册开发人员) ,但不确定)。

For Reference Do Check WWDC 2012 video Session on EVOLUTION OF VIEW CONTROLLER, in case you haven't (I Believe they are available only for registered developers, but not sure).

回答你的第二个。

[对象发布];在dealloc。在释放之前无需为对象指定nil。

[object release]; in dealloc. No need to assign nil to object before releasing.

这篇关于不再在ios6中调用viewDidUnload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆