为什么Xcode没有为我自动添加viewDidUnload?

时间:2012-10-12 21:00:15

标签: objective-c ios xcode ios5

我正在阅读关于iOS 5开发的这篇文章,它说:

Delete all the methods except for viewDidUnload. When you’re finished,
your implementation should look like this:

#import "BIDViewController.h" @implementation BIDViewController
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view. // e.g. self.myOutlet = nil;
}
@end

只是,我从来没有那种方法。它说当我链接动作和出口时它应该自动为该方法添加方法,但由于我必须随机添加它,它似乎不会这样做。

2 个答案:

答案 0 :(得分:4)

因为在iOS 6中不推荐使用此方法。See the docs.

答案 1 :(得分:2)

此方法现已弃用

顺便说一句,如果您没有strong个链接,则无需对IBOutlets做任何事情