Auto Layout with NSSplitView, NSScrollView
Auto Layout with NSSplitView, NSScrollView
- Subject: Auto Layout with NSSplitView, NSScrollView
- From: email@hidden
- Date: Sat, 04 Jan 2014 14:38:45 -0500
Hi,
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 (not a custom view that's similar to NSSplitView) and want to retain the behavior I expect from it, particularly being able to set a minimum width on a pane such that when I drag a divider far enough to close it, it will collapse. Easy enough with delegate methods, not at all clear with auto layout. Similarly, I'd like to have a button to toggle such a view and am not sure how to do that with auto layout as well. It seems to me that one could replace several of the delegate methods with constraints, but at least the same amount of code will have to be written to reproduce the original behavior.
I have not been able to find any sample code online that demonstrates this. To this end, I've created a sample project on GitHub. If anyone can help me with this, I'll be happy to implement it in the demo project to help anyone else with the same problem.
https://github.com/demitri/SplitViewAutoLayout
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?
Thanks for any help, and hopefully this can help others as well.
Cheers,
Demitri
_______________________________________________
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