所以 Arsen 的解决方案看起来不错,但我不知道如何获得故事板的名称,哈哈。对我有用的是
UINavigationController *navigationController = (UINavigationController*)_window.rootViewController;
AVDashboardViewController *dashBoardViewController =
(AVDashboardViewController*)[navigationController.viewControllers objectAtIndex:1];//since on index 0 I have my login screen and index 1 is the home screen
在 AppDelegate 上获取 NavigationController 的引用似乎是不好的编码习惯,但在我的情况下,我需要它,因为它是
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
定位,这是收到Notification时调用的方法之一。收到消息后,我还在为如何更新导航控制器而苦苦挣扎,所以可能跑题了,但这里有一个免费提示:
UIBarButtonItem *notiButton = [[UIBarButtonItem alloc] initWithTitle: @"Received push!" style: UIBarButtonItemStyleBordered target:self action:nil];
[[dashBoardViewController navigationItem] setLeftBarButtonItem:notiButton animated:YES];
[navigationController popToViewController:dashBoardViewController animated:YES];
希望能帮助到你!