iOS-viewController添加渐变色

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];

效果图:


iOS-viewController添加渐变色_第1张图片

你可能感兴趣的:(iOS-viewController添加渐变色)