Re: Auto Layout with NSSplitView, NSScrollView
Re: Auto Layout with NSSplitView, NSScrollView
- Subject: Re: Auto Layout with NSSplitView, NSScrollView
- From: Kyle Sluder <email@hidden>
- Date: Thu, 09 Jan 2014 09:48:31 -0800
On Thu, Jan 9, 2014, at 07:51 AM, Andy Lee wrote:
> As far as I know (see disclaimers), there's no reason you can't implement
> split view delegate methods just because you're using Auto Layout, as
> long as you aren't calling setFrame:.
Nope. Please see the 10.8 AppKit Release Notes, which enumerate all the
delegate methods which will kick you out of Auto Layout mode:
> splitView:constrainMinCoordinate:ofSubviewAt:
> splitView:constrainMaxCoordinate:ofSubviewAt:
> splitView:resizeSubviewsWithOldSize:
> splitView:shouldAdjustSizeOfSubview:
> These methods are incompatible with auto layout. You can typically achieve their effects and more with auto layout.
<https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/>
> I would guess it's perfectly all
> right to implement splitView:constrainSplitPosition:ofSubviewAt:, examine
> the proposedPosition argument, and allow the view's width to be either
> zero or >= the minimum width but not in between.
This is very much not allowed, and wouldn't have been the correct
approach even before auto layout.
To achieve this effect, add a mandatory greater-than-or-equal-to width
constraint to the subview you want to be collapsible, and implement
-splitView:canCollapseSubview: to return YES for that subview.
--Kyle Sluder
_______________________________________________
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