答案,从dbarker确定感谢指针,是当一个视图的didReceiveMemoryWarning
一个默认的实现已卸载的观点后重新加载视图控制器的旋转方法,包括-willRotateToInterfaceOrientation:duration:
和-willAnimateRotationToInterfaceOrientation:duration:
,不会被调用。我不知道为什么它会是在应用程序启动不同的,但我有一个解决办法
我所做的就是设置一个布尔伊娃,命名unloadedByMemoryWarning
,以YES
在didReceiveMemoryWarning
,像这样:
- (void) didReceiveMemoryWarning {
unloadedByMemoryWarning = YES;
[super didReceiveMemoryWarning];
}
然后,在viewDidLoad
,如果该标志为真,我把它设置为NO
,然后调用旋转方法自己:
if (unloadedByMemoryWarning) {
unloadedByMemoryWarning = NO;
[self willRotateToInterfaceOrientation:self.interfaceOrientation duration:0];
[self willAnimateRotationToInterfaceOrientation:self.interfaceOrientation duration:0];
[self didRotateFromInterfaceOrientation:self.interfaceOrientation];
}
有点儿吮吸,我要做到这一点,但它的工作,现在我“M不太担心因使用太多内存而被iOS杀死。
视图层次结构之外的视图(而不是UIViewController视图的子视图)? – dstnbrkr 2011-01-11 18:28:27
@dbarker - 不,实际上它是应用程序的主要视图。 – theory 2011-01-11 20:07:34