【发布时间】:2011-04-11 02:19:25
【问题描述】:
通过以下 sn-p,我正在向我的 UIView 添加投影效果。效果很好。但只要我将视图的 masksToBounds 属性设置为 YES。不再渲染阴影效果。
self.myView.layer.shadowColor = [[UIColor blackColor] CGColor];
self.myView.layer.shadowOpacity = 1.0;
self.myView.layer.shadowRadius = 10.0;
self.myView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
self.myView.layer.cornerRadius = 5.0;
self.myView.layer.masksToBounds = YES; // <-- This is causing the Drop shadow to not be rendered
UIBezierPath *path = [UIBezierPath bezierPathWithCurvedShadowForRect:self.myView.bounds];
self.myView.layer.shadowPath = path.CGPath;
self.myView.layer.shouldRasterize = YES;
您对此有什么想法吗?
【问题讨论】:
标签: ios objective-c uiview calayer