Best way to use navigation controller for uipopoverview
I want to push to another view from a popoverview. For that purpose I had a taken navigation controller to that popover. And also its working fine.
The problem occurs in the second view. To allow the user to send an email i show a mail composer. But i am getting two navigation controllers.
Here is the code for the first popoverview:
SettingsVC *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SettingsVC"]; vc.delegate = self; UINavigationController *naviCon = [[UINavigationController alloc]initWithRootViewController:vc]; self.settingsPopover = [[UIPopoverController alloc] initWithContentViewController:naviCon]; CGRect frame = CGRectMake(974.f, 36.f, 0, 0); self.settingsPopover.popoverContentSize = CGSizeMake(300, 250); [self.settingsPopover presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
When I needed something similar, I called the MFMailComposeViewController from the ViewController which calls the PopoverController (the parent ViewController) and also included the delegate ect in that ViewController. I defined a protocol in the ContentViewController of the PopoverViewController which informs the parent ViewController when it needs to call the MFMailComposeViewController. All worked perfectly without a problem... hope that helps