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”

Working with CALayer

What is CALayer

CALayer is an object responsible for drawing and animations and it is part of Core Animation framework.

It is always used as backing store for UIViews to manage visual content but it can be also used without views.

If it was created by a view the view assigns itself as delegate for that layer and you should not change that. Continue reading “Working with CALayer”