NavigationController does not set view properties correctly when pushed

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-05-24T00:01:13Z Indexed on 2010/05/24 0:10 UTC
Read the original article Hit count: 240

I have a UITabBarControllerDelegate that pushes a new view controller when a certain tab is pressed:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
    MyView* myView = [[[MyView alloc] initWithNibName:@"MyView" bundle:nil]autorelease];
        if([self.tabBarController.selectedViewController.title isEqualToString:@"Friends"]){
        NSLog(@"Clicked Friends");
        myView.reloadFriends = TRUE;
        [self.navigationController myView animated:YES]; 
    }
}

However, if I change my code to set the tabbar's selected view controller to myView everything works, but I don't get my navigation bar:

if([self.tabBarController.selectedViewController.title isEqualToString:@"Friends"]){
        NSLog(@"Clicked Friends");
        myView.reloadFriends = TRUE;
        self.tabBarController.selectedViewController = myView; 
}

How can I set the reloadFriends property in MyView and have the navigation bar at the top?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c