[英]load storyboard viewcontroller from didReceiveRemoteNotification
I have used storyboard. 我已经使用了情节提要。 The app is tab bar controller based. 该应用程序基于标签栏控制器。
When push notification is clicked, I want to open specific "Notification Event" view controller from storyboard." I have no idea what code goes into didReceiveRemoteNotification
. 单击推送通知后,我想从情节提要中打开特定的“ Notification Event”视图控制器。”我不知道在didReceiveRemoteNotification
什么代码。
here my code is: 这是我的代码:
NSString *notification = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
Dashboard *ds = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"Dashboard"] ;
NotificationTable *nt = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"NotificationBoard"] ;
UIStoryboardSegue *segue = [UIStoryboardSegue segueWithIdentifier:@"NotificationBoardTable"
source:ds
destination:nt
performHandler:^{
}];
[ds performSegueWithIdentifier:@"NotificationBoardTable" sender:ds];
Let's see if this is what you want: 让我们看看这是否是您想要的:
[[NSNotificationCenter defaultCenter] postNotificationName:kReceiveNotification object:nil userInfo:YOUR_DATA_PASSING];
Then receive it in your custom tab view controller: 然后在您的自定义选项卡视图控制器中接收它:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(YOUR_HANDLE_METHOD:) name:kReceiveNotification object:nil];
Don't forget to remove the observer when deallocating: 在分配时,请不要忘记删除观察者:
[[NSNotificationCenter defaultCenter] removeObserver:self];
Finally in that method: 最后在该方法中:
[self setSelectedIndex:xxx];//If you want to switch tab
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.