I have a few UILabels
with colored background and I added CAGradientLayers
to them like below.
CAGradientLayer * gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = [NSArray arrayWithObjects:
(id) [UIColor colorWithWhite:1 alpha:0.3].CGColor,
(id) [UIColor colorWithWhite:0.5 alpha:0.3].CGColor, nil];
gradientLayer.frame = label.bounds;
gradientLayer.cornerRadius = label.layer.cornerRadius;
[label.layer insertSublayer:gradientLayer atIndex:0];
On iPhone 4 and iPhone 5s it looks perfect, but on iPhone 6s the CAGradientLayers
are misplaced horizontally like the following screenshot.
This problem happens for UIButtons as well.
I am running iOS 9.3.