self.filterCollectionView.reloadData()
调用重载数据后,调用可见单元格的cellforItem,但在我来回滚动之前,我的单元格值不会更新
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath)
cell.backgroundColor = UIColor.clearColor()
cell.selected = false
cell.alpha = 1.0
for each in cell.contentView.subviews{
each.removeFromSuperview()
}
let title = UILabel(frame: CGRectMake(0, 0, cell.bounds.size.width, 40))
title.text = filterArray[indexPath.row]
title.textColor = UIColor.blueColor()
title.textAlignment = .Center
cell.layer.cornerRadius = 4.0
cell.contentView.addSubview(title)
return cell
}