ios中做出颜色渐变的效果

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    CAGradientLayer *gradient = [CAGradientLayer layer];  
    gradient.frame = self.view.bounds;  
    gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor redColor] CGColor], (id)[[UIColor whiteColor] CGColor], nil nil];  
    [self.view.layer insertSublayer:gradient atIndex:0];