美文网首页
iOS 箭头

iOS 箭头

作者: SunshineBrother | 来源:发表于2020-07-14 11:35 被阅读0次
    - (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;
    }
    

    相关文章

      网友评论

          本文标题:iOS 箭头

          本文链接:https://www.haomeiwen.com/subject/xxsqictx.html