答案,從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