Re: How to toggle the subviews of a split view?
Re: How to toggle the subviews of a split view?
- Subject: Re: How to toggle the subviews of a split view?
- From: Jacob Engstrand <email@hidden>
- Date: Sat, 14 Dec 2002 02:31:17 +0100
John Clayton wrote:
I use the
outermost custom view in the subview to do the resizing, I get it's
frame, create a new rect with the width I want, and then set the frame
to the new rect. Seems like it should work, but logging tells me that
the final resized frame has a different width than the one I have set.
Hmmm.
This used to drive me mad, too. Until I realized that you need to set
the sizes of the actual subviews of the split view. Sort of like this
(myTableView is one of the two things I put in the split view):
[[[myTableView superview] superview] setFrame: myFrame];
Since the first superview of a table view is a clip view and the next
is the scroller, and it is the scroller that is the direct subview of
the NSSplitView and is the one you need to set.
For a textedit, it is even worse:
[[[[myTextEdit superview] superview] superview] setFrame:
myTextEditFrame];
Of course, remeber to set the frame sizes _exactly_ right, so the
hights of the frames and the divider together fill the entire height of
the BSSplitView. (But I guess you already knew that, huh?)
Also, be sure to let the window resize itself _before_ calculating the
frame sizes and calling -adjustSubviews (like if you open the Window
and resize it programatically before showing, you dont want to call
-adjustSubviews in the windowDidLoad or awakeFromNib.)
Hope this helps. (Someone please tell me if I'm wrong! I'd actually
like to be wrong in this case! :)
/jak
_________________________________________________________
Magician. Have rabbit. Will travel.
_______________________________________________
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.