ios 学习之你画我话绘图七 椭圆形

来源:互联网 发布:2016年网络直播元年 编辑:程序博客网 时间:2024/05/01 02:31

   绘椭圆想行的两种方法 等同


 ///////////////////////////////one//////////////////////////

     //创建画布

    CGContextRef contextref =UIGraphicsGetCurrentContext();

    //设置画笔宽度

    CGContextSetLineWidth(contextref,5.0f);

    //设置画笔颜色

    CGContextSetRGBStrokeColor(contextref,0.0, 1.0,1.0, 1.0);

    //添加椭圆

CGContextAddEllipseInRect(contextref,CGRectMake(30.0,30.0, 80.0,80.0));

   //添加路径

CGContextStrokePath(contextref);

///////////////////////////////////////////////////// two////////////////////////////////

    //填充颜色

 CGContextSetRGBFillColor(contextref, 0.0, 0.0, 1.0, 1.0);

//画个椭圆行

CGContextStrokeEllipseInRect(contextref,CGRectMake(100.0,120.0, 60.0,60.0));

//对圆形经行填充

CGContextFillEllipseInRect(contextref,CGRectMake(100.0,120, 60.0,60.0));