On 17 Mar 2012, at 2:48 PM, Erik Stainsby wrote:
> I've got a popover controller which loads one of several subviews ('panels'
> below) as it's content. I have properties on the controller which expose the
> current panel's height and width. The popover resizes correctly but fails to
> place the panel correctly. If the replaceSubview:with: is called before the
> resize (as illustrated) the panel appears shifted down by half it's height,
> leaving half of the panel content inaccessible. If the -replaceSubview:with:
> call is placed after the resize, the inserted panel is half invisible off the
> top edge of the popover.
>
> Does anyone understand what on earth is happening? And what I can do about it?
>
>
> @implementation RSPanelPopoverController
>
> @synthesize popover = _popover;
> @synthesize box = _box;
> @synthesize activePanelWidth;
> @synthesize activePanelHeight;
>
> - (void) showPanelPopover:(NSView*)locator activePanel:(NSView*)panel {
>
> [[self view] replaceSubview:[self box] with:panel];
>
> [self setActivePanelWidth: panel.frame.size.width];
> [self setActivePanelHeight: panel.frame.size.height];
>
> [[self popover] showRelativeToRect:[locator bounds] ofView:locator
> preferredEdge:NSMinYEdge];
> }
I'm not clear on a few things. It appears that the "panel" frame is offset one
way or the other, but I don't see the frame being set, nor the panel being
translated. You say that the order of setActivePanel…: matters, but you don't
show that the methods (odd, but not wrong, that you don't use dot notation) do
anything but change the value of an instance variable. If they actually change
view geometry, you'll have to show us.
What class does RSPanelPopoverController descend from?
What is .box? (It appears that it can be replaced only once.) Have you logged
the frames of .box, .view, and panel, before and after the replacement? And
.view.bounds?
— F
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]