我正在向视图层添加阴影,如下所示:
self.view.layer.shadowOffset = CGSizeZero;
self.view.layer.shadowOpacity = 0.10f;
self.view.layer.shadowRadius = 5.0f;
self.view.layer.shadowColor = [UIColor blackColor].CGColor;
self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:
CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width - 5.0, self.view.bounds.size.height)].CGPath;
self.view.clipsToBounds = NO;
我想要做的是以某种方式剪辑阴影,使其不会超出宽度,但会超出高度。基本上,我只想要一个 90 度的阴影,而不是我的边界周围的阴影。我尝试从 bezierRect 宽度中减去 shadowRadius 量,但这会稍微弄乱底部的阴影流。
任何想法如何实现?