码迷,mamicode.com
首页 > 其他好文 > 详细

绘制三角形矩形

时间:2015-03-31 23:53:59      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

 /**绘制三角形*/
    CGContextRef contextRef=UIGraphicsGetCurrentContext();
    CGContextMoveToPoint(contextRef, 100, 100);
    CGContextAddLineToPoint(contextRef, 100, 200);
    CGContextAddLineToPoint(contextRef, 200, 200);
    
    CGContextMoveToPoint(contextRef, 100, 100);
    CGContextAddLineToPoint(contextRef, 200, 200);
    CGContextSetStrokeColorWithColor(contextRef, [UIColor redColor].CGColor);
    CGContextStrokePath(contextRef);
    
     
    /**绘制矩形*/
    CGContextRef contextRef=UIGraphicsGetCurrentContext();
    CGContextAddRect(contextRef, CGRectMake(50, 100, 200, 200));
    CGContextSetRGBFillColor(contextRef, 1, 0, 0, 1.0);
    CGContextFillPath(contextRef);
    
    /**绘制矩形*/
    CGContextMoveToPoint(contextRef, 100, 100);
    CGContextAddLineToPoint(contextRef, 200, 100);
    CGContextMoveToPoint(contextRef, 100, 100);
    CGContextAddLineToPoint(contextRef, 100, 200);
    CGContextMoveToPoint(contextRef, 100, 200);
    CGContextAddLineToPoint(contextRef, 200, 200);
    CGContextMoveToPoint(contextRef, 200, 100);
    CGContextAddLineToPoint(contextRef, 200, 200);
    CGContextStrokePath(contextRef);
    

 

绘制三角形矩形

标签:

原文地址:http://www.cnblogs.com/thbbsky/p/4382187.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!