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