Splitview + Scrollview pinning

  • 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
  • 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.
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today