One of the pieces of code I find myself re-using constantly is creating a gradient background for a UIView in iOS. This example will show two examples of how to create a simple gradient background. First, in Xcode, create a new Single View iOS application Then create a new file File > New > New File and call this file “BackgroundLayer”, this will create BackgroundLayer.h and BackgroundLayer.m auto
![Gradient background for UIView in iOS](https://cdn-ak-scissors.b.st-hatena.com/image/square/5442b6360e0c56f90b9f0c72b808a0af4ea4c8c8/height=288;version=1;width=512/https%3A%2F%2Fdanielbeard.files.wordpress.com%2F2012%2F02%2Fsingleview.jpg%3Fw%3D300)