我在我的iPhone应用程序中实现了一个Passcode功能,它有一个UITabBarController作为根视图控制器。我把一切都在大多数情况下工作的伟大,从tabBarController显示模式密码的ViewController当应用程序进入后台,像这样:当应用已经显示,当一个模式视图控制器Passode ViewController从模态视图演示
- (void)applicationDidEnterBackground:(UIApplication *)application
{
if ([[NSUserDefaults standardUserDefaults] valueForKey:kPasscodeStringKey]) {
PasscodeEntryVC *passcodeView = [[PasscodeEntryVC alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:passcodeView];
[tabBarController presentModalViewController:nav animated:NO];
}
}
我的问题就来了它进入背景。然后,不出现密码视图。什么是正确的方法来做到这一点?我不应该只是发送消息给tabBarController来呈现视图,而应该首先检查当前视图的内容,然后让它显示密码?如果是这样,这是如何完成的?谢谢。
谢谢。我正在使用ARC,所以内存很好。为了清晰起见,我将来会使用保留/释放来发布代码。 如果我想在现有的模态视图之上显示模态密码视图?任何快速获取当前视图控制器的引用的方式,无论它是否为模态? –