I am presenting a view controller as a popup and in the popup view controller i have a button , onclick of that button i am trying to push a view controller but nothing happens on click.How to do this?
Presnting the view controller as a popup
- (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];
}
Trying to push the view controller from popup view controloer
- (IBAction)resetButtonAction:(id)sender {
HMLoginViewController *HMLoginViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"HMLoginViewController"];
[self.navigationController pushViewController:HMLoginViewController animated:YES];
}
After presenting, if you want to use navigation stack then you have to create new navigation controller :
- (IBAction)resetButtonAction:(id)sender {
HMLoginViewController *HMLoginViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"HMLoginViewController"];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:HMLoginViewController];
[self presentViewController:nc animated:YES];
}
After HMLoginViewController, now you can push to other UIViewController