(shortSide + SIZE * 0.5, longSide * 2)];
[path addLineToPoint:CGPointMake(shortSide, longSide * 2)];
[path closePath];
// step 2: 根据路径生成蒙板
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = [path CGPath];
// step 3: 给cell添加模版
self.layer.mask = maskLayer;
self.backgroundColor = [UIColor orangeColor];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.frame = self.contentView.frame;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
?
|