1
我已經實現了集合視圖有兩個自定義單元格更新標籤,當我執行的前一小區的一些動作,並移動到下一個單元格
當我按下然後第一個單元格滾動到一個按鈕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
}
}
你可以添加你的代碼嗎? – Hitesh
編輯可以請檢查 –