我有一個iPad應用程序,它有一個主視圖控制器,然後是一個設置視圖控制器。當我的主視圖呈現設置視圖時,我將全屏顯示設置視圖。在設置視圖中有一個解除按鈕,它可以工作 - 直到發生內存警告。如果在屏幕上顯示設置按鈕時發生內存警告,它將拒絕解除。內存警告是否破壞了呈現視圖控制器?
換句話說,這個工程:
- 應用程序啓動 - >顯示主視圖 - >顯示設置查看 - >關閉設置查看
這不:
- 應用程序啓動 - >顯示主視圖 - >顯示設置視圖 - >內存警告 - >關閉設置視圖
設置視圖將停留在那裏。
我在第一代iPad上的iOS 5上運行此應用程序。 (我不支持iOS 4.)
我該如何解決這個問題?
編輯:
這裏是我的代碼顯示設置視圖:
- (void) showSettings{
if (!self.settingsViewController) {
//Create the navigation controller and the root view for the settings panel
SettingsViewController *settingsRootView = [[SettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *settingsView = [[UINavigationController alloc] initWithRootViewController:settingsRootView];
[settingsRootView release];
//Configure the animation and modal style, and the navigation bar's color
[settingsView.navigationBar setTintColor:kDarkGrayColor];
//Enable the settings flag
[self setSettingsIsActive:YES];
//Configure the presentation
[settingsView setModalPresentationStyle:UIModalPresentationFullScreen];
[settingsView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
self.settingsViewController = settingsView;
[settingsView release];
}
//present and release the settings panel
[self presentViewController:self.settingsViewController animated:YES completion:^{
}];
}
這裏就是我如何隱藏:
//This method reloads some stuff and
- (void) dismissSettings{
//
// ... Reload some other stuff...
//
//Dismiss the settings panel
[self dismissViewControllerAnimated:YES completion:^{
//
// ... Reload some other stuff...
//
}];
}
你發現了什麼給你記憶警告?你是否在做任何didReceiveMemoryWarning中做任何事情? – Rob 2012-01-27 13:50:00
@Rob - 不要和不要。 – Moshe 2012-01-27 16:21:40