每当应用程序来自applicationDidEnterBackground方法中的背景时,我需要从appDelegate中显示一个ViewController。从appDelegate呈现ViewController
* securityCheck提示用户输入密码非常类似于iOS中的正常密码。一旦验证密码,我将在securityCheck中调用dimissViewControllerAnimated,并且我留下了空白的UINavigationController,因为视图是从appDelegate展示的,我没有提供视图的记录,所以我不能使用popToRootViewController。
我的问题是我该如何正确解雇SecurityCheckViewController,以便在应用程序进入后台之前显示用户所在的ViewController。
这里是我的代码:
这种方法被称为内部AppDelegate.m
- (void)securityCheck {
SecurityCheckViewController *securityCheck = [[SecurityCheckViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:securityCheck];
[securityCheck presentedByAppDelegate:YES];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window setRootViewController:navigationController];
[self.window makeKeyAndVisible];
}
然后SecurityCheckViewController.m里面我有
- (void)unlockWasSuccessfulForPadLockScreenViewController:(ABPadLockScreenViewController *)padLockScreenViewController {
[self.appDelegate securityCheckDone];
[padLockScreenViewController dismissViewControllerAnimated:YES completion:nil];
NSLog(@"Sucsessfull Unlock");I'm
}
什么是'presentsByAppDelegate' – meda 2014-09-04 21:25:11
它是一个布尔我设置,所以我知道它是从AppDelegate提供的,因为我还在每次启动应用程序时提供安全检查,只有验证后我会调用popToRootViewController并且它可以工作。 – 2014-09-04 21:26:55
马科斯,你使用故事板 – meda 2014-09-04 21:30:10