点击本地通知

时间:2018-06-11 07:12:12

标签: notifications navigation local popviewcontroller dismissviewcontroller

这是我的第一个问题,对不起,如果有任何错误! 当用户点击本地通知时,我想呈现一个特定的viewController。所以我做了如下: -

-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler{

   if(completionHandler != nil)   
        completionHandler();

    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"doSignIn"];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" 
    bundle:nil];
    LoggedInVC *obj=[storyboard 
              instantiateViewControllerWithIdentifier:@"loggedInScreen"];
    //[self.window.rootViewController.navigationController 
              pushViewController:obj animated:YES];
    self.window.rootViewController = obj;
}

它也有效,但我在屏幕上有一个后退按钮,如果从这里显示此视图,则该按钮不起作用。我试过两种方式: -

-(void)backbuttonclick
{
     [self.navigationController popViewControllerAnimated:YES];
    //[self.navigationController dismissViewControllerAnimated:YES 
      completion:nil];
}

但没有运气,我做错了什么?请帮忙。

0 个答案:

没有答案