I have a problem dismissing a popover that was launched from the navigationItem of a UINavigationController. It seems that the navigation item which is inserted by the UINavigat
Here's the complete description for popovers in storyboards. Assuming your controller to appear in the popover is named MyPopupController
, do this:
MyPopupController
scene, using style Popover
.Add a property to MyPopupController.h
@property (weak, nonatomic) UIPopoverController *popover;
Synthesize the property in MyPopupController.m
@synthesize popover = _popover
In the prepareForSegue:sender:
method of the main scene controller, set up the popover
property:
UIStoryboardPopoverSegue *ps = (UIStoryboardPopoverSegue *)segue;
MyPopupController *dc = ps.destinationViewController;
dc.popover = ps.popoverController;
In the viewWillAppear:
method of MyPopupController
, add the following code (don't forget [super viewWillAppear]
as well):
self.popover.passThroughViews = nil;
You should be done now.
Thanks to Robert for the basic idea - I just had to find the correct place because presentPopoverFromBarButtonItem
is not used when using storyboards. Note that putting (5) into viewDidLoad
does not work.
Have fun coding!