I am adding a shadow to a CALayer
but I would like this shadow to only be on the left and right side of the view. Does anyone know if this is possible?
Currently, I am adding the shadow like this:
view.layer.shadowColor = [UIColor blackColor].CGColor;
view.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
view.layer.shadowOpacity = 1.0f;
view.layer.shadowRadius = 4.0f;
view.layer.shadowPath = [UIBezierPath bezierPathWithRect:view.bounds].CGPath;
You set the shadow path to the bounds of the view. Try getting that rect, and expanding it using CGRectInset
(with negative x value, and 0 y value). This will give you a shadow path that expands beyond the left and right sides of the layer. You may need to tinker with the radius or inset the y value slightly to prevent the shadow appearing above and below.