使用PushView控制器和Popviewcontroller使应用程序崩溃

时间:2014-01-06 00:45:43

标签: ios uiviewcontroller pushviewcontroller popviewcontroller

在我的应用程序中,我使用push和pop视图控制器在UIViewControlers之间导航。我有一个UIViewcontroller A和UIViewController B.当我点击UIViewcontroller A中的一个按钮并使用下面的代码

UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController = [storybord instantiateViewControllerWithIdentifier:@"editmessage"];
[self.navigationController pushViewController:viewController animated:YES];

我能够导航到UIViewController B.在B中,点击后我有一个取消按钮我需要回到A.我正在使用的代码在下面

NSLog(@"You did it");
[self.navigationController popViewControllerAnimated:YES];
NSLog(@"You did it again");

当我按下UIViewcontroller A中的按钮时,我能够导航到UIViewcontroller B,B的viewdidload方法被执行。但我在日志文件中看到以下消息。

2014-01-06 11:40:58.056 padua[5710:60b] View Did Load of editmesage controller
2014-01-06 11:40:58.231 padua[5710:60b] nested push animation can result in corrupted navigation bar
2014-01-06 11:40:58.633 padua[5710:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

当我按下取消按钮时,B的viewdidload再次被执行。我不确定为什么会这样,应用程序进入只显示空白背景图像的状态。请在下面找到日志。请让我知道我哪里出错了。

CODE

-(IBAction)cancelMessage:(id)sender{
NSLog(@"You did it");
[self.navigationController popViewControllerAnimated:YES];
NSLog(@"You did it again");

}

日志

014-01-06 11:40:58.795 padua[5710:60b] Unbalanced calls to begin/end appearance transitions for <editMessageController: 0x1900d440>.
2014-01-06 11:41:04.683 padua[5710:60b] You did it
2014-01-06 11:41:04.708 padua[5710:60b] View Did Load of editmesage controller
2014-01-06 11:41:04.769 padua[5710:60b] You did it again

0 个答案:

没有答案