我想通过在表格 View 中选择一行来推送 SecViewController
。我正在使用 Storyboard 来实现它。这是我的代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SecViewController *sec = [[SecViewController alloc] init];
[self.navigationController pushViewController:sec animated:NO];
}
为什么会这样?
最佳答案
如下更改代码:
SecViewController *sec = [self.storyboard instantiateViewControllerWithIdentifier:@"viewControllerIdentifier"];
[self.navigationController pushViewController:sec animated:NO];
将 viewControllerIdentifier 更改为该 View Controller 的 Storyboard标识符..
希望对你有帮助..
关于iOS - 调用方法 : [self. navigationController pushViewController : animated:], 屏幕全黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37141131/