美文网首页iOS Developer
iOS-viewController添加渐变色

iOS-viewController添加渐变色

作者: 东岳哥哥 | 来源:发表于2017-06-22 20:21 被阅读0次

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添加渐变色

    本文链接:https://www.haomeiwen.com/subject/maaxcxtx.html