Reputation: 631
I have a Navigation controller with a master-detail view. The detail view's navigation bar shows the back button on left and I use a UIBarButtonItem with a UIPopoverController on the right for additional features.
The right button correctly displays the popover and pressing anywhere in the view does dismiss the popover.
My problem is that, when the popover is active, the navigation bar back button is also still active. So when a user tries to dismiss the popover and presses on the bar back button, the navigation controller unwinds back to the master view and the popover is still visible!
I tried placing the popover on a UIButton inside the view instead of the navigation bar, and there the behavior is as expected: if you try to close the popover by pressing anywhere, even on the Navigation back button, then closes the popover (instead of calling the back button and unwinding to the master view)
In either case, I used the story board to create the Popover by control dragging from the button (UIBarButton or UIButton) to the target view controller.
Is this expected or am I doing something wrong ??
Thanks!
Upvotes: 0
Views: 939
Reputation: 6856
When a UIPopoverController
is presented from a UINavigationBar
or UIToolBar
the Bar is added to it's passthroughViews
property by default.
Clearing this property on load/appear of the UIPopoverController
should fix your problem.
Upvotes: 3