The next code was working fine in ios6. It is supposed to apply a top and bottom inner alpha gradient to a view:
CAGradientLayer * gradient = [CAGradientLayer layer];
gradient.frame = self.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor clearColor] CGColor],
(id)[[UIColor whiteColor]CGColor],
(id)[[UIColor whiteColor]CGColor],
(id)[[UIColor clearColor] CGColor],
nil];
gradient.startPoint = CGPointMake(0.5, 0.0);
gradient.endPoint = CGPointMake(0.5, 1.0);
gradient.locations = [NSArray arrayWithObjects:@0,@(val),@(1.-val),@1,nil];
self.layer.mask = gradient;
BUT! If I run this code in iOS7, instead of a nice blending alpha gradient the "transparent" parts of the gradient are solid white.