Re: Help: NSScrollView is resizing its documentView down to (0, 0)
Re: Help: NSScrollView is resizing its documentView down to (0, 0)
- Subject: Re: Help: NSScrollView is resizing its documentView down to (0, 0)
- From: email@hidden
- Date: Wed, 06 May 2015 14:30:59 +0900
Sent from my iPhone
> On 2015/05/06, at 9:58, email@hidden wrote:
>
> If you have AutoLayout on in a window it's actually on for all views.
> NSScrollView and its hierarchy are a bit weird though.
> Thing to do is create height and width constraints for the document view and outlets for them so you can configure them.
I forgot to mention another nice approach is to simply create two CGFloat properties that are height and width, then return those as the NSSize from inside an override of intrinsicContentSize.
Then you save a ton of code.
The only trick is you need to have it at least non zero at the beginning or it will be hosed.
That method creates size constraints implicitly.
> If you're using 10.10+ you can make them configurable in IB.
> Then add a subview as your real document view.
>
> For upper left corner origin you need to subclass NSClipView and return YES from an override of isFlipped.
> Set the class in IB for both.
> You also want to uncheck the item for translatesAutoresizingMasks
> If that doesn't appear in IB you can set it in code or just return NO from a getter override.
_______________________________________________
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