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: Luther Baker <email@hidden>
- Date: Wed, 06 May 2015 23:10:49 -0500
On Wed, May 6, 2015 at 11:54 AM, Jens Alfke <email@hidden> wrote:
>
> > On May 6, 2015, at 8:36 AM, Uli Kusterer <email@hidden>
> wrote:
> >
> > So you're not setting a constraint on the *document* view? How do you
> expect it to know how to constrain that view otherwise?
>
> The size of the document view is fundamentally unrelated to the size of
> the clip or scroll view — the whole point of having a scroll view is that
> you have an arbitrarily large document! So I wouldn’t expect the scroll
> view to be trying to constrain the size of the document view at all. The
> app code is in charge of deciding how big the document view is, based on
> the content it displays.
>
I'm probably missing something ... but fundamentally, the whole point of
constraints between the scrollview and its children is so that the
scrollview knows how big to make its contentSize. It sounds like you've got
this flipped ... the scrollview is not trying to constrain the size of the
document at all - when using autolayout, the scrollview is dynamically
trying to determine it's *own* contentSize. I know you skipped that report
I sent you - but by doing so, I think you're missing some helpful insight.
You post sounds like you're just frustrated it didn't just work in IB ...
and you're upset you've finally got to actually learn about this
new-fangled layout paradigm.
> > IIRC you need to implement updateConstraints to create proper
> constraints, or intrinsicContentSize, or maybe both.
>
> I’ve never seen the intrinsicContentSize property before (partly because
> it’s not defined in NSView.h.)
This is Autolayout 101 stuff. 2013. Admittedly, maybe you're not doing much
iOS work ... but this was all part of the replacement for the UIView
sizeThatFits frame stuff. There an ecosystem here of how all this works
together.
> Reading the docs for it, it makes sense that I’d override it. And
> searching the docs for that name I found the “Auto Layout Guide”, which
> looks very useful but which I wouldn’t have found otherwise because I
> didn’t know to look for the keyword “auto layout” (everywhere else it’s
> called “constraints”…
"Autolayout" is not a new term :-) ... What do you mean "everywhere" ...
and what is "its"?
Take heart Jens! I'd suggest that it isn't quite as difficult as your
thread alludes to. It isn't an old timer thing either ... but it does take
some understanding and experimentation. Its an abstraction over frames. Its
a level of indirection ... and I'm am sorry that IB doesn't just handle it
automatically. Indeed there will be much gnashing of teeth going forward if
you really decide to dig in ... it is much more nuanced than literally
setting and tracking frames.
Just my $0.02. I thoroughly enjoy your contributions to this group and I'll
just say that this entire thread really surprised me. Hang in there! It
isn't that difficult!
Thanks,
-Luther
> —Jens
> _______________________________________________
>
> 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
>
_______________________________________________
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