// set the category
// .. get parent
NSArray * viewControllerArray = [self.navigationController viewControllers];
int parentViewControllerIndex = [viewControllerArray count] - 2;
UIViewController * parent_vc = [viewControllerArray objectAtIndex: parentViewControllerIndex];
// .. if the category changed
if(![parent_vc.navigationItem.backBarButtonItem.title isEqualToString: cat_name]){
// update the back button title
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle: cat_name style: UIBarButtonItemStyleBordered target: nil action: nil];
parent_vc.navigationItem.backBarButtonItem = newBackButton;
[newBackButton release];
}
No comments:
Post a Comment