>> I have an iPad app with a UIToolbar across the top, and a couple of
>> UIPopoverControllers that come out of buttons in that toolbar. One of the
>> things I notice is that when a popover is open, you can still click on other
>> buttons in the UIToolbar, and it doesn't go through the normal
>> UIPopoverController delegate chain (i.e.
>> -popoverControllerShouldDismissPopover:). This is really problematic, as it's
>> really inappropriate for those items to be tapped while the popover is
>> showing. Any suggestions?

My book devotes considerable space to this problem. I regard this behavior as 
absolute vile, and it is even more vile when the popover is generated 
automatically and you can't get a reference to it (as with a search controller 
/ search bar pair). At least in this case you _can_ get a reference to it, 
since you created it. As the book says:

====

You should give attention to your popover controller's +passthroughViews+, as 
the default behavior may be undesirable. In particular, if a popover is 
summoned by the user tapping a UIBarButton item in a toolbar using 
`presentPopoverFromBarButtonItem:...`, the _entire toolbar_ is a passthrough 
view. This means that the user can tap any button in the toolbar — including 
the button that summoned the popover in the first place! The user can thus by 
default summon _another copy of the same popover_ while this popover is already 
showing, which is certainly not what you want. I like to set the 
+passthroughViews+ to nil; at the very least, while the popover is showing, you 
should probably disable the UIBarButtonItem that summoned it.

Getting the timing right on setting a UIPopoverController's +passthroughViews+ 
is not easy. It might not have any effect unless the UIPopoverController has 
_already_ been sent `presentPopover...`. This is one of the reasons I dislike 
popover segues; you don't get an event after the segue presents the popover, so 
there's no good moment to set the +passthroughViews+ to nil — and, although you 
can set the +passthroughViews+ in the nib editor, you can't set them to nil 
there.

====

Another possibility, if you're determined to use a popover segue, is to set the 
toolbar `userInteractionEnabled` to NO while the popover is showing.

But really, as I say in the book, this is all part of the primitive, brainless 
lack of real popover management. They sucked when they were introduced in iOS 
3.2 and they have not been improved or changed in any way since then. I have a 
long-standing bug in on the whole thing, including this particular issue.

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do
iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to