【发布时间】:2017-01-31 04:51:45
【问题描述】:
我之前从 tableView 传递了一些数据,如下所示:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if( segue.identifier == "productList_to_detail" ) {
let VC1 = segue.destination as! ShopItemVC
if afData == 1 {
if let indexPath = self.tableView.indexPathForSelectedRow {
let productIdToGet = sCategory[indexPath.row]
VC1.product_id = productIdToGet.product_id
}
}
}
}
正如您所见,当我点击特定的 Cell 时,它会从中获取一些数据并传递与 Cell 相关的数据。现在我想用 CollectionView 做同样的事情。当我点击 CollectionView 的特定 item 时,我想从中获取一些价值并通过 segue 传递它。我怎样才能做到这一点 ?
【问题讨论】:
标签: uitableview swift3 uicollectionview uicollectionviewcell