Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,706
6,289
I just noticed that when I started a new tab bar based iPhone application, the second view says "Loaded from SecondView.nib"

I was wondering... can I do something like that for my other views (possibly even outside of tab bar based applications?)

Edit: Oh, and obviously I'd like to know how to do it. Is there something in the inspector that I'm just overlooking that'll let me set it up so a view will load an external nib (/xib)?

2X Edit: Ooh!

I think I found it! When I click on the button (the view controller), then open the inspector, in the inspector, under attributes, you can enter the NIB name.

... i need to take a look at the documentation on the view controllers I think. I'll bet I can change which nib it loads from with that. That would make hiding/showing different panels a lot easier (or rather just designing the interface/layout.) Right now I have them all layered on top of each other and like 40 different outlets so I can hide/show them all. It's getting very tedious and I was thinking I might find a better way with the tab bar based application. I think this is exactly what I wanted...

the class is called UIViewController.

3X Edit: Looking through the properties... it looks like I have to set the nib file that it'll load from in Interface Builder and can't change it later (the property is read-only.) Too bad but I'll take what I can get.

Oooh! This is how you handle rotation/orientation too!

4X Edit: Hmmm... I wasn't able to make it ever successfully load a view from another XIB... but I finally found out that I don't have to. A much easier way to design a tab bar application is to just start with a tab bar based application, drag in all the tabs you need, then select each tab and drag in a view that fills the screen. If you don't drag a view in first it won't let you drag anything else in. It's weird and I consider it a bad interface design that Apple makes the dashed outline view different from any other view (they make it so if you try dragging something else in, it'll replace the dashed outline view with whatever you drag in... a very useless feature as how often do you actually want an entire tab to be composed on only one object?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.