iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar

后端 未结 20 2018
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 20:14

I keep getting the following errors:

2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55         


        
20条回答
  •  [愿得一人]
    2020-11-30 20:56

    My problem had to do with the keyboard being active.

    This was caused for me by pushing a ViewController from a textField's delegate method:

    -(void)textFieldDidBeginEditing:(UITextField *)textField{
    
            FilterLocationViewController *destViewController = (FilterLocationViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"FilterLocationViewController"];
    
            [self.navigationController pushViewController:destViewController animated:YES];
    
    }
    

    By changing the code to this:

    -(void)textFieldDidBeginEditing:(UITextField *)textField{
    
            [_textFieldLocation resignFirstResponder]; //adding this line
    
            FilterLocationViewController *destViewController = (FilterLocationViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"FilterLocationViewController"];
    
            [self.navigationController pushViewController:destViewController animated:YES];
    
    }
    

    (adding the line [textField resignFirstResponder];) the problem went away.

    Basically the lesson is that you shouldn't modify the navigationController stack if the keyboard is out.

提交回复
热议问题