Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Interface Builder and Vertical Split View

Interface Builder and Vertical Split View
Thread Tools
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Jul 4, 2004, 10:21 AM
 
Hello,

First I ought to qualify my question by saying that I'm a complete beginner hoping to learn Cocoa (with some C, WinAPI and Visual Studio experience), and whilst I'm waiting for the delivery of a couple of books on Objective-C and Cocoa (thanks to those who recommended the books on this forum), I thought I'd play around with Interface Builder before abandoning GUI stuff for a while and getting into the nitty gritty. I have what is hopefully a very basic question relating to split views in interface builder:

I would like to implement a vertical split view. This is easy if I'm only using two elements, but I want to do it with three, one on one side, two on the other. For instance: If I take a table view and drag it to the left of my window, then take a text view and drag it to the right, then select both and click on Layout > Make Subviews of > Split View, Interface Builder detects that I want a vertical split view and works very nicely. However, if I place a text view on the left and then on the right of it place, say, a table view at the top and an outline view at the bottom, where the top of the table view is aligned to the top of the text view and the bottom of the outline view is aligned to the bottom of the text view, I have problems. The setup would be like this:

Code:
------------- | ||___| | || | | || | -------------

where the double lines represent where the split view should be. I have tried selecting the two elements on the right - the table view and outline view, for instance - and grouping them, then selecting both the group and the table view, and then clicking on Layout > Make Subviews of > Split View, but this only creates a horizontal split view - moving both the elements on the right below the left window. If I then change the attributes to "Vertical", all of the items are stretched rather than restoring there original size, so that my whole design has been ruined.

Is there an easy way of doing this? All the documentation I can find just says that if my items are ordered left-to-right then a vertical split view should automatically be created, but none of it details what to do if you have an object on the left and a group of view items - rather than a single view - on the right.

If this is stuff I can figure out on my own once I've plowed through a Cocoa book, please forgive me - I'm admittedly jumping the gun a bit here.

Many thanks,
KB
     
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Jul 4, 2004, 02:01 PM
 
OK.. I think I have an easy solution for you. First a diagram with labels:
Code:
--------------------------- | | | | | B | | | | | A |-------------| | | | | | C | | | | ---------------------------
What you need to do is first create all 3 views that you are going to use, then select B and C, and Layout->Group them. Then select A and (B,C) and make them a subview of a NSSplitView. This should do what you want off bat.

You could also make B and C sub-views of their own View (Scroll or Split for example) and then that a sub-view of your main NSSplitView.
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jul 4, 2004, 02:01 PM
 
If you want a three-way split view (similar to what you get in iTunes when Browse mode is on), you'll just need to use Make Subviews of Split View twice: once to create a horizontal splitter between the two views on the right, and again to split that newly created NSSplitView from the view on the left.

If you don't want a draggable separation between the views on the right, group them using Make Subviews of > Custom View. That'll create a plain old NSView encompassing them (and add 20px margins which you'll probably want to get rid of). Then you can select that view and the the view on the left and combine them into a split view.
Rick Roe
icons.cx | weblog
     
Ambit  (op)
Fresh-Faced Recruit
Join Date: Jul 2004
Status: Offline
Reply With Quote
Jul 4, 2004, 04:20 PM
 
Thank you for the replies, I really appreciate it.

Making the two views on the right subviews of a custom view and then creating the split view from that and the text view worked perfectly, thank you very much. Like you say, the border is way too wide, but I will leave working out how to fix that until after I've got the basics down (I've just started in on Kochan and have Hillegass and Davidson lined up...) - no point trying to run before I can walk.

Many thanks for the solving my problem,
KB
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:39 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2