pop to first view controller (root view controller ) from third view controller navigationItems are not being changed

11,935

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];
    }
}
Share:
11,935
Rani
Author by

Rani

Updated on June 05, 2022

Comments

  • Rani
    Rani almost 2 years

    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.