更新标签,当我执行的前一小区的一些动作,并移动到下一个单元格
问题描述:
我已经实现了集合视图有两个自定义单元格更新标签,当我执行的前一小区的一些动作,并移动到下一个单元格
当我按下然后第一个单元格滚动到一个按钮collectionviiew中的第二个单元格,但我需要更改第二个单元格内的标签值
假设我在第一个单元格中有一个文本字段,第二个单元格中有一个标签。
当我在第一个单元格中输入值,然后单击下一步,然后我从第一个单元格调用一个块并将集合视图滚动到第二个单元格,并且想要设置我在第一个文本字段中输入的标签的值细胞。
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
switch indexPath.item {
case 0:
let secondCell = collectionView.dequeueReusableCell(withReuseIdentifier: "secondCell", for: indexPath) as! SecondCell
secondCell.packages = FindJobVC.subcripDetail.package
secondCell.moveToNextStep = { textFieldValue in
// here I want to change the label text of CheckoutCell
self.cvFindJob.scrollToItem(at: IndexPath(item: indexPath.item + 1, section: 0), at: .centeredHorizontally, animated: true)
self.cvFindJob.reloadItems(at: [IndexPath(item: indexPath.item + 1, section: 0)])
}
return secondCell
case 1:
let checkoutCell = collectionView.dequeueReusableCell(withReuseIdentifier: "CheckoutCell", for: indexPath) as! CheckoutCell
checkoutCell.makePayment = {
self.makePayment()
}
checkoutCell.moveToPreviousStep = {
self.cvFindJob.scrollToItem(at: IndexPath(item: indexPath.item - 1, section: 0), at: .centeredHorizontally, animated: true)
}
return checkoutCell
}
}
答
您只需要取消选中“预取已启用”,即可开始使用。
祝你好运
+0
感谢您的帮助.. –
你可以添加你的代码吗? – Hitesh
编辑可以请检查 –