Re: Merging scrolling/clipping with NSStackView
Re: Merging scrolling/clipping with NSStackView
- Subject: Re: Merging scrolling/clipping with NSStackView
- From: Quincey Morris <email@hidden>
- Date: Thu, 19 Jan 2017 10:25:12 -0800
- Feedback-id: 167118m:167118agrif8a:167118shXaxtdZ-e:SMTPCORP
On Jan 19, 2017, at 06:39 , Daryle Walker <email@hidden> wrote:
>
> The inner views should be as tall as they need to be.
I don’t understand this part. How tall is that?
I assume you mean that you want the text and table views to be tall enough to show all of their contents, then stacked together and wrapped in a single scroller. Conceptually that makes sense, but:
1. The stack view is going to size itself, in the absence of explicit constraints, based on the *intrinsic* sizes of the stacked views, and neither text nor table view is going to report its full height as its intrinsic height. Re-working them to provide that information is going to be very, very painful.
2. Neither text nor table view is *intended* to be full height. Instead, they are intended to show a “window” of a fixed height onto a much taller virtual height. That’s why they come pre-wrapped in individual scroll views. A table view in particular is intended to prepare only the (relatively few) cells that are actually visible at any one time. By forcing it to its “full” height, you’re forcing it to keep every row in existence permanently. The performance might be acceptable if the table is not very large, but it’s still something of an abuse. Ditto the text view, although less so.
In such a situation, I think I would do one of the following:
— Rethink my UI so that I don’t have to stack the text and table views in this way.
— Use only a table view, and place the text view as the first row of the table. (With view-based table views, it’s easy to have more than one prototype cell view.) It would still be a bit messy, since it would be a variable-row-height table, but it’s likely less work than trying to achieve the same effect using stack view constraints.
— Use a (new-style) NSCollectionView, using two sections and custom flow layouts for the sections.
_______________________________________________
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