Skip navigation.
 
mlRe: Splitview + Scrollview pinning
FROM : Troy Stephens
DATE : Sat Jan 19 01:24:43 2008

On Jan 18, 2008, at 3:58 PM, Ben Lachman wrote:
> I have a splitview that encloses two custom views.  One is a pretty 
> straight forward, just drawing some text inside a frame with some 
> some effects.  The other, which does more custom drawing is enclosed 
> in a scroller-less scrollview.  This is all created programatically, 
> including the window they're in.  Everything works well until I drag 
> the divider of the splitview.  When I do this the top view resizes 
> properly, but the bottom view is clipped at the top instead of 
> staying pinned where it is like other views.  When I look at the 
> frame/bounds rects for the views it seems the clipview's origin is 
> staying constant and it's size is changing.  The splitview and 
> scrollview are flipped but the clipview and custom view is not. 
> Anyone know a workaround for this kind of issue?
>
> Thanks,
> ->Ben


The pinning is determined by the document view's flippedness.  Since 
your custom document view isn't flipped, the bottom-left corner of its 
visible rect will remain pinned while its top edge is covered/revealed 
as the splitter is dragged.

To get top-left pinning instead, you can either change your document 
view to be flipped (requiring changes to its internal layout/drawing 
logic, and obviously affecting all instances of that view), or make it 
the subview of an identically-sized instance of a flipped NSView 
subclass, and make that flipped wrapper view the ScrollView's document 
view.

That should do it (unless I misunderstood something in your statement 
of the problem?).

--
Troy Stephens
Cocoa Frameworks
Apple, Inc.

Related mailsAuthorDate
mlSplitview + Scrollview pinning Ben Lachman Jan 19, 00:58
mlRe: Splitview + Scrollview pinning Troy Stephens Jan 19, 01:24