Hos*_* Ap 1 pushviewcontroller ios swift
我有一个tableview,并且我想在点击行之一时转到另一个vc。我的didSelectRowAtIndexPath函数如下。print命令有效,并显示右键单击的行。但是当我使用self.navigationController?.pushViewController时,它不会通过playVideo storyBoardId进入vc。将其更改为presentViewController后,它可以工作。我的代码有什么问题,推送不起作用?
谢谢
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("clicked " + String(indexPath.row) )
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("playVideo") as! PlayVideoViewController
vc.id = self.video[indexPath.row].id
// Present View as Modal
//presentViewController(vc as UIViewController, animated: true, completion: nil)
// Push View
//self.navigationController?.pushViewController(vc, animated: true)
}
Run Code Online (Sandbox Code Playgroud)
如果您需要推送视图控制器,请执行以下步骤。
self.navigationController?.pushViewController(vc,动画:true)
会很好的。
| 归档时间: |
|
| 查看次数: |
2710 次 |
| 最近记录: |