- (UIView *)arrowView{
if (!_arrowView) {
// draw
CGSize size = CGSizeMake(kDefaultArrowWeight, kDefaultArrowHeight);
UIBezierPath *path = [[UIBezierPath alloc] init];
[path moveToPoint:CGPointMake(size.width / 2.0, 0)];
[path addLineToPoint:CGPointMake(0, size.height)];
[path addLineToPoint:CGPointMake(size.width, size.height)];
path.lineWidth = 1.0;
CAShapeLayer *arrowLayer = [CAShapeLayer layer];
arrowLayer.path = path.CGPath;
_arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
_arrowView.layer.mask = arrowLayer;
_arrowView.backgroundColor = self.contentViewBackgroundColor;
}
return _arrowView;
}
网友评论