NavigationController does not set view properties correctly when pushed
- by Sheehan Alam
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?