核心在于对 layer 的处理
//设置开始和结束位置(设置渐变的方向)
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.startPoint = CGPointMake(0, 0);
gradient.endPoint = CGPointMake(1, 0);
gradient.frame =CGRectMake(0,0,SCREEN_WIDTH,BottomHeight);
gradient.colors = [NSArray arrayWithObjects:(id)HEXCOLOR(@"25CA9A").CGColor,(id)HEXCOLOR(@"009B83").CGColor,nil];
[self.bottomButton.layer insertSublayer:gradient atIndex:0];
网友评论