Dismiss Popover using Unwind Segue in Xcode Storyboard
- by AlexR
I am using Xcode 4.5 and the new iOS 6 feature to unwind segues. I am presenting a navigation view controller inside a popover which is presented programmatically from a bar button item:
- (IBAction)configChartTapped:(id)sender
{
if (self.popover.isPopoverVisible) {
[self.popover dismissPopoverAnimated:YES];
} else {
UINavigationController *chartConfigNavigationController = [self.storyboard instantiateViewControllerWithIdentifier:@"GrowthChartNavigationController"];
ConfigChartTypeViewController *configChartTypeViewController = (ConfigChartTypeViewController*) chartConfigNavigationController.topViewController;
self.popover = [[UIPopoverController alloc]initWithContentViewController:chartConfigNavigationController];
self.popover.popoverContentSize = CGSizeMake(320, 500);
self.popover.delegate = self;
[self.popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
Next to this method I have defined a target to unwind the segue (i.e. dismissing the popover)...
- (IBAction)cancelConfig:(UIStoryboardSegue *)segue
{
//
}
... and connected it to a cancel button in the navigation view controllers's navigation bar.
Connecting the cancel bar button to the cancelConfig button worked fine in Xcode.
However, when running the code, nothing happens when clicking on the Cancel button despite Xcode 4.5 should be supporting dismissing popovers when unwinding segues (according to the release docs).
What did I miss?
Thank you!