Re: Autolayout frustrations with NSOutlineView [SOLVED, +follow-up question]
Re: Autolayout frustrations with NSOutlineView [SOLVED, +follow-up question]
- Subject: Re: Autolayout frustrations with NSOutlineView [SOLVED, +follow-up question]
- From: Quincey Morris <email@hidden>
- Date: Tue, 29 Jul 2014 19:42:42 -0700
On Jul 29, 2014, at 18:52 , Graham Cox <email@hidden> wrote:
> What I want is to have my enclosed custom view 'stick' to the top, left (or wherever it's scrolled to) of the clip view as long as it's larger than the clip view, but become horizontally and vertically centered in the clip view if it's smaller (e.g. when zoomed so that its frame shrinks). This is a fairly classic requirement, and has been solved in the past by having a custom clip view that can recognise the 'smaller than' situation and force its contained view to be centred.
Actually, I’ve never (that I recall) taken that approach, but rather constrained the “document” view (the clip view’s child) to be at least as large as the clip view — and coincident with the clip view when they’re the same size, of course.
Then, when the content is zoomed in far enough, it can just be drawn directly on the central part of the (too-large) document view, or you can add a subview pinned to the center of the document view that’s responsible for the drawing.
There are a couple of other good reasons to draw in a clip-view-size document view, rather than a smaller view that just encloses the content:
1. If you have the ability to drag out a selection rectangle, its visible representation doesn’t stop at the edges of the central portion of the clip view.
2. IIRC, the ruler annotations stop drawing at the boundaries of the document view, which in your scenario produces blank ruler sections that can look mighty strange.
3. If there’s an inner focus-ring indication of some sort for the content area, I think it looks better drawn just inside the clip view bounds, rather than the smaller content bounds. (But I had to draw a custom indication, because it was on the inside of the view instead of the outside. Now that we have more robust outer-focus-ring drawing mechanisms, I don’t think I’d bother with the custom inside-view focus ring any more.)
_______________________________________________
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