我正在尝试从按钮操作推送视图控制器。我能够推动我的视图控制器并查看第二个视图控制器页面。现在我点击后退按钮再来到我的第一个视图控制器。现在,当我再次按下按钮时,我的应用程序崩溃,而[self.navigationController pushViewController:about animated:NO];
这是我的代码,
FirstVC.m
- (IBAction) proceedButton:(id)sender {
if(news == nil) {
news = [NewsViewController instantiate];
}
[UIView beginAnimations:@"ShowNews" context: nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
self.navigationController.navigationBarHidden = NO;
UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithTitle : @"Back"
style : UIBarButtonItemStyleDone
target : nil
action : nil];
self.navigationItem.backBarButtonItem = back;
[self.navigationController pushViewController:news animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
}
SecondVC.m
+ (instancetype)instantiate {
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"NewsScreen" bundle: nil];
return (NewsViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: @"About"];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = NO;
.....
.....
}
导航控制器的已检查值,尝试将我的动画更改为YES。但它不起作用。请帮助。 TIA。