Re: NSPopover tear-off problem
Re: NSPopover tear-off problem
- Subject: Re: NSPopover tear-off problem
- From: Keary Suska <email@hidden>
- Date: Mon, 13 Oct 2014 08:39:00 -0600
On Oct 12, 2014, at 10:02 PM, Graham Cox <email@hidden> wrote:
> On 13 Oct 2014, at 2:43 pm, Graham Cox <email@hidden> wrote:
>
>> But if I turn the popover into a window by allowing it to be dragged, the window's content is screwed up - instead of sizing the overall view to fit the window, a subview (an NSTableView) is sized to fill the window, and some other views (a search field and a button) end up on top of the table. The button is in the right place, but the search field is too wide and extends beyond the window edge. Perhaps there is a problem with having a table view inside a popover? It seems to work fine, so I think that's unlikely. Perhaps the problem is with struts/springs being translated into constraints?
>
> A further clue I've just doscovered: if I set the popover.animates = NO, the window is shown properly with its content in the right places. This suggests that the issue is with NSPopover's animation to the window. It seems to be trying (and failing) to be too clever, animating each subview's frame to its equivalent in the window.
>
> However, since it has no possible information about which view in the two places are equivalent to each other, it must be using some sort of brain-dead method to figure out the associations. This is really stupid - either implement a method so that our code can give it the information or do not attempt such a thing. It seems it's deciding that my table "must be" the overall view and so sizes it to fit the window. Wrong! It wouldn't be quite so bad if I had the opportunity to fix it up but I don't.
I came across this problem, although my theory was that the window was being sized from small to larger, which of course makes springs and struts whacko when views ares forced to overlap. Even auto layout doesn't solve it quite--I had to make sure that every subview had a fixed position. Even then, the content view would have a bad origin (0,-8) and I had to override setFrame: to correct it. This might have been a 10.7 bug, as I haven't tested it since.
There may be a way with auto layout-based animations, but I haven't the wherewithal to pursue it.
HTH,
Keary Suska
Esoteritech, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden