从呈现的弹出视图控制器推送视图控制器



我将视图控制器显示为弹出窗口,在弹出视图控制器中我有一个按钮,单击该按钮时,我正在尝试推送视图控制器,但单击时没有任何反应。怎么做?

将视图控制器预置为弹出窗口

- (IBAction)sendOTPAction:(id)sender {
HMResetPasswordViewController *resetPassword = [self.storyboard instantiateViewControllerWithIdentifier:@"HMResetPasswordViewController"];
// configure the Popover presentation controller                             
                        resetPassword.modalPresentationStyle = UIModalPresentationPopover;
resetPassword.preferredContentSize = CGSizeMake(self.view.frame.size.width-10, 375);
resetPassword.popoverPresentationController.delegate = self;
resetPassword.popoverPresentationController.permittedArrowDirections = 0;
resetPassword.popoverPresentationController.sourceView = self.view;
resetPassword.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds),0,0);
[self presentViewController:resetPassword animated:YES completion:nil];
}

尝试从弹出式视图控制器推送视图控制器

- (IBAction)resetButtonAction:(id)sender {
HMLoginViewController *HMLoginViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"HMLoginViewController"];
                        [self.navigationController pushViewController:HMLoginViewController animated:YES];
}

呈现后,如果要使用导航堆栈,则必须创建新的导航控制器:

  - (IBAction)resetButtonAction:(id)sender {
     HMLoginViewController *HMLoginViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"HMLoginViewController"];  
     UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:HMLoginViewController];
     [self presentViewController:nc animated:YES];
     }

在HMLoginViewController之后,现在可以推送到其他UIViewController

相关内容

  • 没有找到相关文章

最新更新