做一个颜色渐变的view
//初始化CAFradientLayer
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bianseView.frame
self.bianseView.layer.addSublayer(gradientLayer)
//设置开始和结束位置
gradientLayer.startPoint = CGPointMake(0, 0)
gradientLayer.endPoint = CGPointMake(1, 0)
//设置渐变的颜色数组
gradientLayer.colors = [UIColor(red: 175/255.0, green: 235/255.0, blue: 212/255.0, alpha: 1).CGColor,UIColor(red: 255/255.0, green: 175/255.0, blue: 220/255.0, alpha: 0.7).CGColor]
//设置渐变维度,0为开始,1为结束
gradientLayer.locations = [0,1]
<!--more-->