zoukankan      html  css  js  c++  java
  • iphone 绘图

    虚线

    CGContextSetStrokeColorWithColor(myContext, [UIColor blackColor].CGColor);
    CGContextSetLineDash (myContext,phase,lengths,2);
    CGContextClosePath(myContext);
    CGContextStrokePath(myContext);

    ================================================================

    切线

    - (void)drawRect:(CGRect)rect {

            CGContextRef context = UIGraphicsGetCurrentContext();

            CGContextSetLineWidth(context, 2.0);

            CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

            CGContextMoveToPoint(context, 100, 100);
            CGContextAddArcToPoint(context, 100,200, 300,200, 100);
            CGContextStrokePath(context);
    }

    ================================================================

    - (void)drawRect:(CGRect)rect {

            CGContextRef context = UIGraphicsGetCurrentContext();

            CGContextSetLineWidth(context, 2.0);

            CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

            CGRect rectangle = CGRectMake(60,170,200,80);

            CGContextAddEllipseInRect(context, rectangle);

            CGContextStrokePath(context);
    }

    ================================================================

     

    - (void)drawRect:(CGRect)rect {

            CGContextRef context = UIGraphicsGetCurrentContext();

            CGContextSetLineWidth(context, 2.0);

            CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

            CGContextMoveToPoint(context, 10, 10);

            CGContextAddCurveToPoint(context, 0, 50, 300, 250, 300, 400);

            CGContextStrokePath(context);
    }

    ================================================================

     

    - (void)drawRect:(CGRect)rect {

            CGContextRef context = UIGraphicsGetCurrentContext();

            CGContextSetLineWidth(context, 2.0);

            CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

            CGContextMoveToPoint(context, 10, 200);

            CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200);

            CGContextStrokePath(context);
    }

    ================================================================

     

    - (void)drawRect:(CGRect)rect {

            CGContextRef context = UIGraphicsGetCurrentContext();

            CGContextSetLineWidth(context, 5.0);

            CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);

            CGFloat dashArray[] = {2,6,4,2};

            CGContextSetLineDash(context, 3, dashArray, 4);

            CGContextMoveToPoint(context, 10, 200);

            CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200);

            CGContextStrokePath(context);
    }

  • 相关阅读:
    QQ下面功能移动效果
    网页中选择功能
    自定义listview
    android的内存优化分析【转,超级推荐】
    animation的xml定义中的android:interpolator属性(转)
    HOME键与Notification配合使用的bug重现【原创】
    (转载)Android下Affinities和Task(开发者指南)
    职场加薪步步高升的五大法则(转)
    强引用,软引用和弱引用。
    更改字体的ttf。
  • 原文地址:https://www.cnblogs.com/iapp/p/3631811.html
Copyright © 2011-2022 走看看