Hi,
I'm trying to display a gradient using CAGradientLayers. I just set two colors and i expect to see a gradient between them, unfortunately only the first plain color is displayed without any gradient.
Here is my code :
- (void)viewDidLoad {
[super viewDidLoad];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = CGRectMake(0.0, 0.0, 480.0, 320.0);
gradientLayer.colors = [NSArray arrayWithObjects:
(id)[UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0].CGColor,
(id)[UIColor colorWithRed:0.85 green:0.85 blue:0.85 alpha:1.0].CGColor,
nil];
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(480, 320);
[self.view.layer addSublayer:gradientLayer];
}
Any help would be greatly appreciated !
Thanks in advance, Vincent.