Create UIView with gradient background

Add gradient background to UIView using CAGradientLayer

Using CAGradientLayer

CAGradientLayer is a layer that draws gradient color over its background.

By default color are spread evenly but you can control the locations of them.

CAGradientLayer example

The following function will add a gradient layer to the view passed to it Continue reading “Create UIView with gradient background”