第0节(细胞分离和单一选择)
我使用下面的代码来圆顶角落。
//roundTop Method
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = [[UIScreen mainScreen] bounds];
maskLayer.path = maskPath.CGPath;
maskLayer.lineJoin = kCALineJoinBevel;
self.layer.masksToBounds = YES;
self.layer.mask = maskLayer;
[self drawBorderLayer:maskPath];
-(void)drawBorderLayer:(UIBezierPath *)maskPath {
if (self.layer.borderWidth > 0) {
CAShapeLayer* frameLayer = [CAShapeLayer layer];
frameLayer.frame = self.bounds;
maskPath.lineWidth = self.layer.borderWidth * 2;
frameLayer.path = maskPath.CGPath;
frameLayer.strokeColor = self.layer.borderColor;
frameLayer.fillColor = nil;
[self.layer addSublayer:frameLayer];
}
}
drawBorderLayer
方法来绘制圆形部分的边框,但它没有足够的宽度。 (绿箭 - A)self.layer.mask = nil;
,但没有尝试 我的cellForRowAtIndexpath
if (sectionModel.sectionStyle == SMFilterSectionStyleGrouped) {
if ([[sectionModel.cells lastObject] isEqual:cellModel]) {
[cell roundBottom];
}else if(indexPath.row == 0) {
[cell roundTop];
}
}