简体   繁体   中英

Fixed Gradient Background for UICollectionView

How do you add a simple two color gradient as background to a UICollectionView. It should cover the whole background and stay fixed even when scrolling the collection view (horizontally).

All layer based solutions I tried so far had issues regarding not covering the whole screen and covering only the initially visible frame. Bonus points for being animatable and not using images ... ;)

What's the best way to do this?

一个简单而快速的解决方案是将UICollectionView的背景颜色设置为“clear”,并添加另一个带有渐变的UIView。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM