我有一个项目,其中我的 VC 嵌入在 MMDrawerController 中。 问题我在我的 appdelegate 中收到了推送通知,但我不知道如何打开我收到通知的特定屏幕。将 VC 作为 centerVC 是行不通的。在我的情况下它没有用,因为某些屏幕有后退按钮。 我也用过
[_drawerController.centerViewController.navigationController pushViewController:pushedVC animated :true]
但它没用它对屏幕没有任何影响。提前感谢任何帮助。
这是我在 AppDelegate 中用于转到 ChatVC 的代码
-(void)GotoChatVCNotification{
UIColor *navBarColor = [UIColor colorWithRed:52.0/255.0 green:56.0/255.0 blue:52.0/255.0 alpha:1.0];
[[UINavigationBar appearance] setBarTintColor:navBarColor];
NSDictionary *titleDict = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes:titleDict];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
ChatVC *centerViewController = [storyBoard instantiateViewControllerWithIdentifier:@"ChatVC"];
centerViewController.User_id = [APPDELEGATE.userDetailsDic objectForKey:@"user_id"];
_otherUserID=[self.dicPushData valueForKey:@"sender_id"];
centerViewController.Reciever_id = [self.dicPushData valueForKey:@"sender_id"];
centerViewController.strFrom=@"notification";
centerViewController.strFriendId = [self.dicPushData valueForKey:@"sender_id"];
centerViewController.strProjectId = [self.dicPushData valueForKey:@"project_id"];
centerViewController.strChatUserName = [self.dicPushData valueForKey:@"full_name"];
centerViewController.strSupportChat = @"Chat";
[[APPDELEGATE.sideController.centerViewController navigationController] popToRootViewControllerAnimated:false];
[[APPDELEGATE.sideController.centerViewController navigationController] pushViewController:centerViewController animated:false];
//我也使用了下面的行,通过它我可以在那个屏幕上重定向,但是我的 MMDrawerController 的虚构在那里不存在。// [[self topMostController] presentViewController:centerViewController animated:NO completion:nil];}