How to implement alpha gradient on a image?

后端 未结 4 1707
陌清茗
陌清茗 2020-12-13 11:02

I want to implement alpha gradient on an image. From 0.5 alfa on top of the image to 0.0 on bottom. Any advice, tutorial, link is welcome.

4条回答
  •  囚心锁ツ
    2020-12-13 11:37

    I found something here, it works great!

    AlphaGradientView* gradient = [[AlphaGradientView alloc] initWithFrame:
                               CGRectMake(self.view.frame.size.width - 150, 0, 150, 
                                                    self.view.frame.size.height)];
    
    gradient.color = [UIColor yellowColor];
    gradient.direction = GRADIENT_RIGHT;
    [self.view addSubview:gradient]; 
    

提交回复
热议问题