美文网首页
iOS中简单的画线功能

iOS中简单的画线功能

作者: 曾柏超 | 来源:发表于2018-03-12 12:58 被阅读0次
    
    #import "ZBView.h"
    
    @implementation ZBView
    
    
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    - (void)drawRect:(CGRect)rect {
        // Drawing code
        
        CGContextRef context = UIGraphicsGetCurrentContext();
    //    CGContextSetLineCap(context, kCGLineCapRound);
    //    CGContextSetLineWidth(context, 3);  //线宽
    //    CGContextSetAllowsAntialiasing(context, true);
    //    CGContextSetRGBStrokeColor(context, 70.0/255.0,   241.0/255.0,   241.0/255.0  ,    1.0);  //线的颜色
        CGContextBeginPath(context);
        
        CGContextMoveToPoint(context, 0, 0);  //起点坐标
        CGContextAddLineToPoint(context, self.frame.size.width, self.frame.size.height);   //终点坐标
        
        CGContextStrokePath(context);
        
    
        
        
    }
    
    
    @end
    
    

    https://www.jianshu.com/p/0546a3b57f16

    https://www.jianshu.com/p/c49833c04362

    相关文章

      网友评论

          本文标题:iOS中简单的画线功能

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