Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何通过单击表格视图单元格进入另一个视图_Ios_Swift_Swift2 - Fatal编程技术网

Ios 如何通过单击表格视图单元格进入另一个视图

Ios 如何通过单击表格视图单元格进入另一个视图,ios,swift,swift2,Ios,Swift,Swift2,嗨,我该如何点击一个tableviewcell来显示另一个视图。谢谢 您需要的是使用didSelectRowAtIndexPath 您可以查看更多信息。使用此didSelectRowAtIndexPath方法 请详细说明您的问题并提供更多信息告诉Xcode创建新项目。选择主/明细模板。它不需要额外的代码就可以满足您的要求。 func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)

嗨,我该如何点击一个tableviewcell来显示另一个视图。谢谢

您需要的是使用didSelectRowAtIndexPath

您可以查看更多信息。

使用此didSelectRowAtIndexPath方法


请详细说明您的问题并提供更多信息告诉Xcode创建新项目。选择主/明细模板。它不需要额外的代码就可以满足您的要求。
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let controller = //Init your controller here
    controller.data = //Pass any needed values to controller
    self.presentViewController(controller, animated: true, completion: nil) //Show your controller
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    self.performSegueWithIdentifier("SEGUETOYOURVIEWCONTROLLERNAME", sender: self)
}