Created
December 6, 2010 20:20
-
-
Save wbroek/730879 to your computer and use it in GitHub Desktop.
Gradiant on a UIView to transparant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALayer *viewLayer = UIVIEW.layer; | |
CAGradientLayer *gradientLayerView = [[CAGradientLayer alloc] init]; | |
[gradientLayerView setFrame:[UIVIEW frame]]; | |
[gradientLayerView setPosition:CGPointMake(UIVIEW.frame.size.width / 2, UIVIEW.frame.size.height / 2)]; | |
[gradientLayerView setMasksToBounds:NO]; | |
[gradientLayerView setColors:[NSArray arrayWithObjects: | |
(id)[[UIColor colorWithWhite:0.0 alpha:1.0] CGColor], | |
(id)[[UIColor colorWithWhite:0.0 alpha:0.0] CGColor], nil]]; | |
[gradientLayerView setStartPoint:CGPointMake(0.5, 0.92)]; | |
[gradientLayerView setEndPoint:CGPointMake(0.5, 1)]; | |
[viewLayer setMask:gradientLayerView]; | |
[viewLayer setMasksToBounds:NO]; | |
[gradientLayerView release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment