我有一个MenuViewController
,通常是rootviewcontroller
。我用
- (IBAction)backToMenu:(UIStoryboardSegue*)unwindSegue {
}
从其他视图控制器返回此视图控制器。但是,如果用户通过点击本地通知启动应用,则应用会显示OtherViewController
。我是这样做的:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *notify = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notify) {
UIStoryboard *tip = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
OtherViewController *viewTip = (OtherViewController *)[tip instantiateViewControllerWithIdentifier:@"OtherViewController"];
[_window.rootViewController presentViewController:viewTip animated:YES completion:nil];
}
}
应用程序在预期的OtherViewController处打开,但是当我点击通常触发menu button
的{{1}}时,我无法返回unwindSegue
。关于如何解决这个问题的任何想法?
编辑:我使用push segue从MenuViewController
转到MenuViewController
。