I am setting gradient to background of my view:
CAGradientLayer *grad = [CAGradientLayer layer];
grad.frame = self.contentView.frame;
grad.colors = @[(id)[[UIColor colorWithRed:1.0f green:0.5f blue:0.5f alpha:0.0f] CGColor],
(id)[[UIColor colorWithWhite:1.0f alpha:0.5f] CGColor],
(id)[[UIColor colorWithWhite:1.0f alpha:0.8f] CGColor],
(id)[[UIColor colorWithWhite:0.0f alpha:1.0f] CGColor]];
grad.locations = @[@0.00f, @0.5f, @0.7f, @1.00f];
self.layer.mask = grad;
Problem is, that every element (UIButton, UILabel...) on top of my view has that then same gradietn as parent. How can I set gradient only for view and not for items, that are on this view ?