0
votes

I declared the two different push segue in the myview1 to display the myview2. Two different push segue is called from two different button actions. Its showing the myview2.

In myview2 I am poping the navigationcontroller back to the myview1 in button action.

I am getting error in ios7 but in the previous version of iOS its working:

nested push animation can result in corrupted navigation bar

Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

myview2:

- (IBAction)saveButtonPressed:(id)sender {

if ([self.addString isEqualToString:@"ADD"]) {
    NSLog(@"11111111add save");
    Xen_ViewController *viewcontroller = [[Xen_ViewController alloc] init];
    DOING some method calling.....
    //[self.navigationController popViewControllerAnimated:YES];
}
else if ([self.addString isEqualToString:@"UPDATE"]){
    NSLog(@"222222222update save");
    Xen_ViewController *viewcontroller = [[Xen_ViewController alloc] init];
    DOING some method calling.....
    .....
}
[self.navigationController popViewControllerAnimated:YES];

myview1:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"CallingConfigurationEdit"]){
    //UINavigationController *navController = (UINavigationController *)segue.destinationViewController;
    Xen_ConfigurationViewController *controller = segue.destinationViewController;
     controller.addString = @"ADD";
}

if ([segue.identifier isEqualToString:@"Updation"])
{
    Xen_ConfigurationViewController *controller = segue.destinationViewController;
    controller.updateString = self.string;
    controller.addString = @"UPDATE";
}

}

How do I overcome this error?

1

1 Answers

2
votes

you are getting that error because you declared two different push segues. There is no need in your case to do that. Declare just one push segue and do not forget to give it an identifier. I´ve tested your code and works just fine, just keep in mind that whatever method call you perform inside of the if statements of your saveButtonPressed method will end up poping the current viewController and you will get back to you MyView1 controller.