'''
/// 给view的背景添加渐变色
- (void)setViewBackColors:(UIColor *)startColor endColor:(UIColor *)endColor andLocations:(NSArray *)locations{
//渐变颜色
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)startColor.CGColor, (__bridge id)endColor.CGColor];
gradientLayer.locations = locations;
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(1.0, 1.0);
gradientLayer.frame = self.bounds;
gradientLayer.cornerRadius = self.layer.cornerRadius;
[self.layer insertSublayer:gradientLayer atIndex:-1];
}
'''
但是 对于UILabel设置背景完全没用啊,uibutton又不能改,终于知道了这个办法
‘’‘
UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_norvip_price_frog"]];
[self setBackgroundColor:color];
’‘’
网友评论