
- (voID)collectionVIEw:(UICollectionVIEw *)collectionVIEw dIDHighlightItemAtIndexPath:(NSIndexPath *)indexPath{UICollectionVIEwCell* cell = [self.collectionVIEw cellForItemAtIndexPath:indexPath];cell.contentVIEw.backgroundcolor = [UIcolor redcolor];}- (voID)collectionVIEw:(UICollectionVIEw *)collectionVIEw dIDUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath{UICollectionVIEwCell *cell = [self.collectionVIEw cellForItemAtIndexPath:indexPath];cell.contentVIEw.backgroundcolor = [UIcolor clearcolor];} 但没有任何事情发生.我删除了细胞中的图像,它完美地工作.但随着图像没有任何反应!我还可以做些什么?
解决方法 如果您有CustomCell,则必须具有CustomCell.m(实现文件).在这个文件中添加这个,对我来说是简单的方法:-(voID)setHighlighted:(BOol)highlighted{ if (highlighted) { self.layer.opacity = 0.6; // Here what do you want. } else{ self.layer.opacity = 1.0; // Here all change need go back }} 总结 以上是内存溢出为你收集整理的ios – 带图像的UICollectionView单元格,单击更改背景全部内容,希望文章能够帮你解决ios – 带图像的UICollectionView单元格,单击更改背景所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)