当用户选择一个单元格时,我想获得其特定的UIViews之一并更改其颜色。无法获取单元格子视图?
所以,
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
for cell in collectionView.visibleCells() as [UICollectionViewCell]
{
if(cell.tag==indexPath.row)
{
for view in [cell.contentView.subviews] {
view.backgroundColor=UIColor.redColor()
//here what ever I try I can't get it to see view as a UIView and change its properties, instead I get error that [UIView] has no member..
这不是工作,这是我已经开始具有明显的方式。在最新的Swift上,你会看到一个错误,因为视图不被识别为UIView。 – Curnelious