Re: NSSplitView divider position
Re: NSSplitView divider position
- Subject: Re: NSSplitView divider position
- From: Ken Thomases <email@hidden>
- Date: Sat, 08 Nov 2014 09:02:19 -0600
On Nov 8, 2014, at 8:19 AM, Luther Baker <email@hidden> wrote:
> Is there a direct way to determine the positions of the dividers in
> NSSplitView.
No.
> If not, are most people calculating this by adding the widths of all the
> "visible" child/container views to the left of the divider index? (I've
> noticed the the widths of "collapsed" views in the split view still have
> the original size).
Well, you can do that, although you also need to account for the dividerThickness for any intervening dividers. You could also query the NSMaxY() or NSMaxX() of the preceding visible view. (Actually, be careful of the user interface direction. Vertical split views that use auto layout respect the user interface direction, so the views may be laid out right to left.)
> Also, it seems that the NSRect returned from this method is interpreted
> more like an iOS rect ... that is, Y and the height seem to be top down and
> not bottom up. Is that because the NSSplitView's internal coordinate system
> is managed as such since the docs say ...
>
> "The rectangle should be expressed in the coordinate system defined by
> *splitView*."
You should not assume either way. You should either a) consult the -isFlipped method on the split view, or b) construct a rect in the coordinate system of one of your own views and then convert to the split view's coordinate system using [theSubview convertRect:theRect toView:theSplitView] or [theSplitView convertRect:theRect fromView:theSubView].
Regards,
Ken
_______________________________________________
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