【发布时间】:2014-09-16 08:21:19
【问题描述】:
如何关闭一个模态然后立即推送另一个视图?
我在 didSelectRowAtIndexPath 中添加此代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ChatTableViewController *chatVC = (ChatTableViewController*)[storyboard instantiateViewControllerWithIdentifier:@"chatVC"];
[self dismissViewControllerAnimated:YES completion:^{
[[self navigationController] pushViewController:chatVC animated:YES];
}];
模态视图消失,但之后没有任何反应。有什么想法吗?
【问题讨论】:
-
签入 [self navigationController] 返回 nil。
-
Not nil: (lldb) po [self navigationController]
-
这段代码是在模态本身上(自行关闭)还是在父视图控制器上(父级关闭它之前呈现的内容)?
-
关闭自己 - 这可能是它不起作用的原因。有什么解决办法吗?
标签: ios objective-c storyboard segue