我想给我的容器UIView添加阴影效果。我使用以下代码实现:
- (id)initWithCoder:(NSCoder*)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
//-> drop shadow
[self.layer setShadowColor:[UIColor blackColor].CGColor];
[self.layer setShadowOpacity:0.6];
[self.layer setShadowRadius:2.0];
[self.layer setShadowOffset:CGSizeMake(2.0, 2.0)];
}
return self;
}
这个效果很好。但是,当我在这个容器UIView上使用_containerView.clipsToBounds = YES;
时,我看不到我的阴影。为什么?
clipsToBounds
的信息:https://dev59.com/zGIj5IYBdhLWcg3wRTH2 - megimix