UI加强(四)之Quartz2d基本绘图

主流框架还没搭好...未完待续...

开启动画之旅:

 1.基本绘图:

#import "TempView.h"

@implementation TempView
/*
 1.自定义view
 2.绘图必须在drawrect中
 3.绘图步骤:
    3.1.绘制图形上下文
    3.2.连线
    3.3.渲染
 */
- (void)drawRect:(CGRect)rect{
    //1.绘制图形上下文
    CGContextRef context = UIGraphicsGetCurrentContext();
    //2.添加路径
    //起点
    CGContextMoveToPoint(context, 0, 0);
    //终点
    CGContextAddLineToPoint(context, 100, 100);
    CGContextMoveToPoint(context, 10, 20);
    CGContextAddLineToPoint(context, 100, 200);
    //3.渲染显示出来
    CGContextStrokePath(context);
    
}

@end

 

posted @ 2016-12-01 15:37  忆缘晨风  阅读(104)  评论(0编辑  收藏  举报