我有一个这样的故事板:
收到推送通知时,我需要打开上图中显示的场景。我试过这种方式:
-(void)application:(UIApplication*)app didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NotificationsViewController *notificationobject = [[NotificationsViewController alloc]init];
[self.navigationController pushViewController:notificationobject animated:YES];
gotNotifcation = YES;
}
但只有它打开NavigationControll黑色。我该怎么办?
答案 0 :(得分:0)
你的故事板中有NotificationsViewController,但我不确定你正在做一个分配的对象& init on是同一个视图控制器。
尝试这样做:
// replace everything between the quotes with the correct name & identifiers
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"myStoryboardName" bundle:nil];
NotificationsViewController *vc = (NotificationsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"myNotificationsViewController"];
[self.navigationController pushViewController:notificationObject animated:YES];
gotNotification = YES;
或者,因为似乎有一个segue可以让你进入你的故事板,尝试做:
[self performSegueWithIdentifier:@"SegueIdentifier" sender:self];