views:

33

answers:

2

I currently have my navigation controllers defined in my appDelegate as followed (code summarized):

- (void) applicationDidFinishLaunching {
tabBarController = [[UITabBarController alloc] init];

    FlagList *flagList = [[FlagList alloc] initWithApiCall:API_PUBLICTIMELINE andTitle:@"Home"];

    UITabBarItem *homeTab = [[UITabBarItem alloc] initWithTitle:@"Home" 
                                                          image:[UIImage imageNamed:@"home.png"] 
                                                            tag:0];
    flagList.tabBarItem=homeTab;
    [homeTab release];

    tabBarController.viewControllers=[NSArray arrayWithObjects:flagList,nil];
    [flagList release];


    [rootViewController release];
    rootViewController = [[UINavigationController alloc] initWithRootViewController:[tabBarController autorelease]];
    rootViewController.navigationBar.barStyle=UIBarStyleDefault;
}

I want to set a title in the navigationBar of my FlagListView. HOWEVER, I want to be able to do this in the -viewDidLoad method of my FlagList UITableViewController class. How can I access this property?

I tried:

[[self navigationItem] setTitle:@"Home"];

..but it doesn't seem to work. Can someone please tell me what I'm doing wrong?

+1  A: 

Assuming FlagList is a descendant if ViewController use [self setTitle:@"Home"] instead of [[self navigationItem] setTitle:@"Home"];

codelark
..I just tried it. Didn't seem to work.
dpigera
and FlagList is a descendent of UITableViewController
dpigera
this seems to work, but no guarantee this is the right way to do this:((RFAppDelegate *)[UIApplication sharedApplication].delegate).tabBarController.navigationItem.title=@"Home";
dpigera
A: 

[self setTitle:@"Home"];

This should work.

Roshan Amadoru