1) 我写了一个指向 UICollectionViewCell 的 profileViewCell.swift 2)我写了一个profileViewController.swift是指向所有的UICollectionViewDelegates
当我尝试像这样在 viewDidLoad 方法中添加代码时
NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: Selector("resetView"), userInfo: nil, repeats: false)
3) 在 resetView 方法中,我可以像这样调用 Collection View 出售第一个对象
函数重置 View (){
let cell:profileViewCell = self.collectionView.visibleCells() as! profileViewCell
self.reset(cell)
}
然后编译器显示错误和警告,如“一如既往地从 [UICollectionViewCell] 转换为不相关的类型 'profileviewCell'”,请帮助我,提前致谢
最佳答案
对 visibleCells
的调用返回一个单元格数组,但您试图将其转换为单个单元格并将其用作单个单元格 - 您不能那样做。您要么需要从数组中取出一个单元格进行处理,要么遍历所有单元格。
关于ios - 一如既往地从 [UICollectionViewCell] 转换为不相关的类型 'profileviewCell',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35499935/