NSScrollView and autolayout
NSScrollView and autolayout
- Subject: NSScrollView and autolayout
- From: Chuck Soper <email@hidden>
- Date: Tue, 26 Feb 2013 14:32:16 -0800
- Thread-topic: NSScrollView and autolayout
Does NSScrollView own its documentView, and controls the value that
documentView returns for setTranslatesAutoresizingMaskIntoConstraints:?
I've created an NSView subclass that I'm using for a documentView within
an NSScrollView. I'm calling [self
setTranslatesAutoresizingMaskIntoConstraints:NO] during initialization. Is
that a problem? The UI works fine, but the layout for my documentView is
ambiguous. I believe that I'm setting its constraints properly.
Would it be better to [scrollView.documentView
addSubview:myContainerView]? Then, add the following constraints to the
scrollView.documentView:
@"V:|[myContainerView]|" and @"H:|[myContainerView]|"
This way, I think that it would be fine to call [self
setTranslatesAutoresizingMaskIntoConstraints:NO] during initialization for
myContainerView.
If this is true, then I think that I may need to call setFrameSize: on
scrollView.documentView when my myContainerView frame size changes, is
that correct? Or, is there some way to get my documentView to resize based
on its subviews (i.e. myContainerView)?
With NSSplitView, I think it's fine to add subviews that use auto layout.
Any help would be appreciated.
Thanks,
Chuck
_______________________________________________
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