Ios UICollectionView-如何';等等';去称重传感器?

Ios UICollectionView-如何';等等';去称重传感器?,ios,swift3,uicollectionview,swift4,Ios,Swift3,Uicollectionview,Swift4,在行中,让cell=self.cv.cellForItem(At:indexPath)作为?CustomCell有时单元格已加载-有时为零 如何确保每次单元格都有实际的单元格项目? 谢谢 cv.reloadData() DispatchQueue.main.async { let indexPath = IndexPath(item: self.index, section: 0) self.cv.scrollToItem(at: indexPa

行中,让cell=self.cv.cellForItem(At:indexPath)作为?CustomCell
有时单元格已加载-有时为零

如何确保每次
单元格
都有实际的单元格项目? 谢谢

    cv.reloadData()
    DispatchQueue.main.async {

        let indexPath = IndexPath(item: self.index, section: 0)
        self.cv.scrollToItem(at: indexPath, at: .top, animated: true)

        let cell = self.cv.cellForItem(at: indexPath) as? CustomCell
        cell?.indicate()
    }