Reputation: 97
I am using a navigation bar on which I push several views according to what the user selects.Now I need to pop to first view controller from third controller.The applications pop to first view controller but navigationItems are not been changed as it is in second view controller but, I need to change navigationItems.
Code that I used: appdelagte.h
Bool isDelete;
@property(nonatomic)Bool isDelete;
appDelegate.m
@synthesize isDelete;
thirdViewController:
-(void)viewWillAppear:(Bool)animated {
appDelegate.isDelete=YES;
[self.navigationController popViewControllerAnimated:YES];
}
secondViewController.m
-(void)viewWillAppear:(Bool)animated {
if(appDelegate.isDelete==YES)
{
[self.navigationController popViewControllerAnimated:YES];
}
}
Here pop to first view controller but navigationItems are not being changed as it is in secon view controller
Any one help me to solve this.Thanks in advance.
Upvotes: 3
Views: 12251
Reputation: 2012
May be you can do this behavior without showing third ctrl? Like do this check if(appDelegate.isDelete==YES)
in second ctrl.
- (void) showThird {
if(appDelegate.isDelete == NO) {
MyThirdCtrlClss *ctrl = [[MyThirdCtrlClss alloc] init];
[self.navigationController pushViewController:ctrl animated:YES];
[crel release];
} else {
[self.navigationController popToRootViewControllerAnimated:YES];
}
}
Upvotes: 12