如何在UICollectionView中更改整个部分的背景颜色? [英] How to change background color of a whole section in UICollectionView?

查看:2001
本文介绍了如何在UICollectionView中更改整个部分的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在UICollectionView中,我想给整个部分一个统一的背景颜色,而不是单个单元格或整个集合视图。



我没有看到任何委托方法,任何建议?

解决方案

这是一个改变UICollectionView部分颜色的好教程:



更新了链接,感谢用户@casamia





请点击此链接了解详情。


In UICollectionView, I want to give the whole section a uniform background color, instead of for a single cell or for the whole collection view.

I don't see any delegate method to do that, any suggestions?

解决方案

This is a great tutorial for changing UICollectionView section color:

Updated link, thanks to user @casamia

http://www.ericjchapman.com/jekyll/update/ios/2014/11/10/ios-changing-section-background-color-in-UICollectionView.html

Basically, we will have to subclass UICollectionViewLayoutAttributes, UICollectionReusableView and UICollectionViewLayout in order to create a instance UICollectionReusableView as section's background view.

This is his result:

Please follow the link for more details explanation.

这篇关于如何在UICollectionView中更改整个部分的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆