• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Q] Programmatically resizing split views in NSSplitView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] Programmatically resizing split views in NSSplitView


  • Subject: Re: [Q] Programmatically resizing split views in NSSplitView
  • From: Andy Lee <email@hidden>
  • Date: Sun, 22 Sep 2002 22:19:38 -0400

At 6:50 PM -0700 9/22/02, Mark de Jong wrote:
I'm trying to programmatically resize a subview of NSplitView. While I can find its subviews by calling the "subviews:" method; and I can successfully resize a subview, the "divider" doesn't move and I can't seem to find a way to make it move.

Here's the code I use for an NSSplitView with two subviews (code slightly edited for public consumption):

// ...calculate NSRects newFrameOne and newFrameTwo...

[subviewOne setFrame:newFrameOne];
[subviewTwo setFrame: newFrameTwo];
[theSplitView adjustSubviews];
[theSplitView setNeedsDisplay:YES];

IIRC, you need to resize *all* subviews of the splitview, and in such a way that their combined size stays the same.

You need to call -adjustSubviews. I think this tells the splitview to recalculate where the divider should be drawn.

I think the -setNeedsDisplay: was needed to get the divider to redraw properly. Without the call, the divider would draw in the right place, but with cruft on it.

I based my code on discussions on this list (or maybe the other) from a while back, so if the above doesn't work for you, you might try searching the archives and/or looking deeper in the NSSplitView docs.

--Andy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: [Q] Programmatically resizing split views in NSSplitView
      • From: Mark de Jong <email@hidden>
References: 
 >[Q] Programmatically resizing split views in NSSplitView (From: Mark de Jong <email@hidden>)

  • Prev by Date: NSTableView of NSColorWell
  • Next by Date: Re: NSTableView of NSColorWell
  • Previous by thread: [Q] Programmatically resizing split views in NSSplitView
  • Next by thread: Re: [Q] Programmatically resizing split views in NSSplitView
  • Index(es):
    • Date
    • Thread