Bernd
Bernd

Reputation: 11503

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?

Upvotes: 0

Views: 1373

Answers (1)

Hannes
Hannes

Reputation: 3772

An easy and fast solution is to set the background color of the UICollectionView to 'clear' and add another UIView with the gradient behind it.

Upvotes: 2

Related Questions