On 4 Jan 2014, at 1:38 PM, [email protected] 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.

This does involve more code than you’d hope the constraint mechanism would 
require, but I don’t think the option is available. Sometimes (often) Apple’s 
automated services require more and harder code to handle needs that go beyond 
the basic. (One could debate whether the old split-view behavior wasn’t basic, 
but even it had its problems.) 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.

> Secondly, I have a button that loads a large image into an NSScrollView into 
> one of the split view's panes. I have a slider to scale the image down. As 
> the image scales, I'd like it to remain centered. I have this working with 
> auto layout, but the container NSImageView is not resizing. It needs to 
> resize down to but not smaller than the clip view (I want to show a 
> background color). Can someone suggest how to do this as well?

You know the size of the image, and of the clip view, and therefore the range 
of valid zoom levels. Can’t you limit the values the slider reports (or the 
controller accepts) so the zoom doesn’t go below minimum?

        — 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]

Reply via email to