Fwd: Re: Auto Layout with NSSplitView, NSScrollView
Fwd: Re: Auto Layout with NSSplitView, NSScrollView
- Subject: Fwd: Re: Auto Layout with NSSplitView, NSScrollView
- From: Michael Starke <email@hidden>
- Date: Thu, 09 Jan 2014 17:00:14 +0100
If I recall correctly, if you did implement ANY delegate method using
10.7 the split view did fall back to a "non-autolayout" aware mode. At
least that was my experince. It did change with 10.8. But take this with
a lot of caution. My memory tends to mess up those things :)
Ah. There was something:
http://www.cocoabuilder.com/archive/cocoa/326128-nssplitview-not-resizing-subviews-if-delegate-is-used.html#326128
-Michael
On 09.01.2014 16:51, Andy Lee wrote:
On Jan 6, 2014, at 11:54 AM, Fritz Anderson <email@hidden> wrote:
On 4 Jan 2014, at 1:38 PM, email@hidden wrote:
I like your user name.
I have a couple of questions about using auto layout (AL) with NSSplitView and NSScrollView. I have watched the (excellent) WWDC videos from 2012, but am having problems.
I'm trying to implement an NSSplitView
[… that collapses one of the views if the user resizes it below a set minimum.]
The next thing I’d try (meaning I have no experience and no time to make the experiment; others’ solutions would trump mine; and I seem to remember this is a solved problem to be found in the archives of this list, Stack Overflow, or [ugh] the Developer Forums) is to see whether listening to the collapsing view’s NSFrameDidChangeNotification was of help. If the frame goes below minimum width, replace the width constraint with a zero.
[same disclaimers as Fritz]
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:. 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.
You might have to fiddle with constraints for the reason Fritz gives:
Constraints for contained views would tend to push the collapsed view’s width out, but reducing the priorities of some of the constraints on the views that would push back should take care of that.
You could also add a *higher*-priority constraint that says the collapsed view's width must be 0, and this would trump the constraints that tend to push back. I think.
--Andy
--
___m i c h a e l s t a r k e____
geschäftsführer
HicknHack Software GmbH
www.hicknhack-software.com
___k o n t a k t____
+49 (170) 3686136
email@hidden
___H i c k n H a c k S o f t w a r e G m b H____
geschäftsführer - maik lathan | andreas reischuck | michael starke
bayreuther straße 32
01187 dresden
amtsgericht dresden HRB 30351
sitz - dresden
_______________________________________________
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