【发布时间】:2012-03-09 23:58:03
【问题描述】:
我正在我的 iPhone 应用程序中实现密码功能,它有一个 UITabBarController 作为根视图控制器。在大多数情况下,通过在应用程序进入后台时从 tabBarController 显示模态密码 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 以呈现视图?如果是这样,这是如何完成的?谢谢。
【问题讨论】:
标签: objective-c ios uiviewcontroller