2
我使用下面的代码,使圆角只为的tableView圆角只为UITableView的
CALayer *capa = self.patientTableView.layer;
//Round
CGRect bounds = capa.bounds;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds
byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight)
cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = bounds;
maskLayer.path = maskPath.CGPath;
[capa addSublayer:maskLayer];
capa.mask = maskLayer;
此代码工作正常的底部边缘,但tableview中没有显示出的底部边缘内容低于其框架高度(但它滚动到其offset.y)。
顺便说一句,你不必添加遮罩层作为子图层。只需设置现有图层的“mask”属性即可。 – Rob