iOS-viewController添加渐变色
设置渐变背景色
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = [UIScreen mainScreen].bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blueColor] CGColor],(id)[[UIColor greenColor] CGColor], nil];
[self.view.layer insertSublayer:gradient atIndex:0];
效果图: