How to create UIImage with vertical gradient using “from-color” and “to-color”

后端 未结 9 571
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 00:09

How to create new image just with gradient colors, using \"from-color\" and \"to-color\"?

9条回答
  •  离开以前
    2021-01-04 00:45

    You can use https://github.com/leszek-s/LSCategories It allows creating image with gradient like this:

    UIImage *gradient = [UIImage lsGradientImageWithSize:CGSizeMake(100, 100) startColor:[UIColor redColor] endColor:[UIColor greenColor] startPoint:CGPointMake(0.0, 0.0) endPoint:CGPointMake(0.0, 1.0)];
    

提交回复
热议问题