Model view controller 本地通知和打开特定屏幕
当我收到本地通知时,我想打开我的特定屏幕。 目前,在我的应用程序中,我使用了导航控制器和模型视图控制器,因此在使用导航控制器时,应用程序将切换任何视图,但当模型控制器退出时。它没有打开屏幕。 请问有什么解决办法Model view controller 本地通知和打开特定屏幕,model-view-controller,uiviewcontroller,uinavigationcontroller,uilocalnotification,Model View Controller,Uiviewcontroller,Uinavigationcontroller,Uilocalnotification,当我收到本地通知时,我想打开我的特定屏幕。 目前,在我的应用程序中,我使用了导航控制器和模型视图控制器,因此在使用导航控制器时,应用程序将切换任何视图,但当模型控制器退出时。它没有打开屏幕。 请问有什么解决办法 There are two way to launch app when notification comes. 1-应用程序正在后台运行。然后打开特定屏幕,如 -(无效)应用程序:(UIApplication*)应用程序未收到本地通知:(UILocalNotification*)通知
There are two way to launch app when notification comes.
1-应用程序正在后台运行。然后打开特定屏幕,如
-(无效)应用程序:(UIApplication*)应用程序未收到本地通知:(UILocalNotification*)通知
{
}
// write this line
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadData" object:self];
}
in which controller class you are create notification.
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reloadTable)
name:@"reloadData"
object:nil];
}
- (void)reloadTable
{
// create object of that controller which your want to open.
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddToDoViewController *cvc = (AddToDoViewController *)[sb instantiateViewControllerWithIdentifier:@"AddToDo"];
[self presentModalViewController:cvc animated:YES];