On 30 Jul 2010, at 3:36 PM, Development wrote:

> I have a nib with two views in it. however the only view that loads is the 
> one connected to the view outlet in the view controller. How can I get the 
> second view to load?

What do you mean that the other view doesn't "load?" How do you know?

There are three ways to access the contents of a NIB.

1. Via -[UIViewController initWithNibName:bundle:], which connects the 
references to outlets in File's Owner (the view controller itself). If a root 
object in the NIB doesn't have a link to the owner's outlet, that object is 
adrift and goes away at the next autorelease drain.

2. Via -[NSBundle loadNibNamed:owner:options:], you specify an owner object, 
which again gets its IBOutlets filled in from links to File's Owner in the NIB. 
No link, no object.

3. By taking the NSArray returned by -[NSBundle loadNibNamed:owner:options:], 
usually with owner: set to nil (though that's not required). The array contains 
all the root objects in the NIB. 

It's up to you to identify the objects: If they're all UIViews, you can set the 
tags in Interface Builder and iterate the array to read the tags and handle 
each as you wish. If only one of the objects doesn't get connected to an 
outlet, you'll know it by iterating the array and picking out the one that 
doesn't appear in an outlet.

        — F

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to