美文网首页
UIBezierPath+YYAdd的学习

UIBezierPath+YYAdd的学习

作者: _阿南_ | 来源:发表于2017-11-09 18:55 被阅读55次
    图片来之网络

    文字画图

    + (nullable UIBezierPath *)bezierPathWithText:(NSString *)text font:(UIFont *)font;
    

    提供了一个将字符串绘画到view上,而不是采用UILabel的形式。
    效果:


    绘画文字

    这些文字是使用Bezier画的。

    使用

    新建UIView,重载方法drawRect:,

    - (void)drawRect:(CGRect)rect
    {
        [super drawRect:rect];
    
        UIBezierPath *bezier = [UIBezierPath bezierPathWithText:@"这个是怎么使用的啊" font:[UIFont systemFontOfSize:30.0f]];
    
    
        [bezier setLineWidth:2.0f];
        [[UIColor cyanColor] setStroke];
        [bezier stroke];
    }
    

    这样做的原因应该为,减少视图的层级,提高页面的性能。

    // END

    相关文章

      网友评论

          本文标题:UIBezierPath+YYAdd的学习

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