我有一个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