首页
学习
活动
专区
圈层
工具
发布

#segue

如何在选择UITableViewCell时进行推送?

这是另一个选项,它不需要使用didSelectRowAtIndexPath。 你只需将Interface Builder中的segue从原型单元连接到目标。 代码: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "AffiliationDetail", let destination = segue.destinationViewController as? AffiliateDetailViewController { if let cell = sender as? UITableViewCell, let indexPath = tableView.indexPathForCell(cell) { var affiliation = affiliations[indexPath.row] destination.affiliation = affiliation } } } ... 展开详请
领券