我有一个位于
以下是所用的代码行:
这是英语文本,翻译成中文如下:
UITableViewCell
中的视图,它有3个圆角和阴影。我正在使用UIBezierPath
来实现圆角,但无法设置阴影。以下是所用的代码行:
CGRect bounds2 = cell.backgroundMessageView.bounds;
UIBezierPath *maskPath2 = [UIBezierPath bezierPathWithRoundedRect:bounds2
byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight|UIRectCornerBottomRight
cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer2 = [CAShapeLayer layer];
maskLayer2.frame = bounds2;
maskLayer2.path = maskPath2.CGPath;
cell.backgroundMessageView.layer.mask = maskLayer2;
//drop shadow
[cell.backgroundMessageView.layer setShadowColor:[UIColor blackColor].CGColor];
[cell.backgroundMessageView.layer setShadowOpacity:1];
[cell.backgroundMessageView.layer setShadowRadius:3.0];
[cell.backgroundMessageView.layer setShadowOffset:CGSizeMake(2, 2)];
这是英语文本,翻译成中文如下:
这应该是结果:
有什么想法吗?
谢谢!