NSPopover subview positioning issue
NSPopover subview positioning issue
- Subject: NSPopover subview positioning issue
- From: Erik Stainsby <email@hidden>
- Date: Sat, 17 Mar 2012 12:48:49 -0700
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];
}
Erik Stainsby
email@hidden
-------------------------------------
Consistently place constants on the LHS of an expression: you cannot accidentally assign when you meant to compare.
_______________________________________________
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