我提出了一个视图控制器作为弹出窗口,在弹出视图控制器中我有一个按钮,单击该按钮,我试图推动一个视图控制器,但是点击时没有任何反应。如何做到这一点?
将视图控制器指定为弹出窗口
- (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];
}
答案 0 :(得分:1)
演示后,如果要使用导航堆栈,则必须创建新的导航控制器:
- (IBAction)resetButtonAction:(id)sender {
HMLoginViewController *HMLoginViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"HMLoginViewController"];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:HMLoginViewController];
[self presentViewController:nc animated:YES];
}
在HMLoginViewController之后,现在您可以推送到其他UIViewController