我想知道在关闭一个 ViewController 后是否可能立即推到另一个 ViewController。
我一直在尝试以下代码:
-(void)dismiss{
//send information to database here
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"Dismiss completed");
[self pushtoSingle:post_id];
}];
}
-(void)pushtoSingle:(int)post_id{
Single1ViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"SingleView"];
svc.post_id = post_id;
svc.page = 998;
[self.navigationController pushViewController:svc animated:YES];
}
还有这个:
-(void)dismiss{
//send information to database here
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"Dismiss completed");
Single1ViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"SingleView"];
svc.post_id = post_id;
svc.page = 998;
[self.navigationController pushViewController:svc animated:YES];
}];
}
但是没有成功。视图已被成功解除,但推送从未初始化...是否有其他已知的解决方法?
UIViewController
已经被解除显示。 - Rui Peres