views:

1715

answers:

1

I'm trying to use Interface Builder to add UIBarButtonItems to the toolbarItems property of the UIViewController.

I have a .xib file and the File's Owner is typed as a subclass of UITableView controller ("ServerTableViewController"). I've dragged a bunch of UIBarButton items into the .xib file thinking that they will show up as part of the toolbarItems property of the ServerTableViewController that represents the File's Owner.

Here's what I don't understand. Let's say I have an .xib file that has a ServerTableViewController in it which is not the File's Owner... I can drag UIBarButton items beneath it and they show up in its toolbar automatically!

Why can I not do the same thing when ServerTableViewController is the File's Owner? That seems to be the only difference.

+1  A: 

I'm not sure if this will help. But I've had better luck doing this programatically. You could try putting something like this in your viewDidLoad method.

ServerTableViewController *stvc = [[UICustomTabViewController alloc]
       initWithNibName:@"ServerTableViewController" bundle:[NSBundle mainBundle]];  
UIBarButtonItem *yourBarButtonItem = [UIBarButtonItem alloc] init];
stvc.navigationItem.rightBarButtonItem = yourBarButtonItem;
[yourBarButtonItem release];
Jonah
I was really hoping there was a way to do it in Interface Builder. It seems to work, but only in special conditions.
Michael Bishop