代码之家  ›  专栏  ›  技术社区  ›  Vikas S Singh Poorva

如何在iPhone上绘制简单的线条动态图

  •  -1
  • Vikas S Singh Poorva  · 技术社区  · 16 年前

    如何在iPhone上绘制简单的线条动态图?默认情况下,X轴应显示利润,Y轴应显示损失值。 我在尝试这个阴谋,但我失败了。你有什么想法或例子吗?请帮帮我。 谢谢。

    3 回复  |  直到 13 年前
        1
  •  0
  •   jithinroy    16 年前

    核心图是一个很好的图表框架。或使用quartz2d手动绘制

        2
  •  0
  •   Vikas S Singh Poorva    15 年前

    我已经解决了。使用简单的线图计算。

        3
  •  -1
  •   Romain    16 年前

    创建自定义视图以处理图形。在这个视图中,做类似的事情(没有测试,只是随时随地写):

    - (void)drawRect:(CGRect)rect;
    {
        [super drawRect:rect];
        CGContextRef ctx = UIGraphicsGetCurrentContext();
        CGContextSetRGBStrokeColor(ctx, 1.0, 0, 0.0, 1);
        CGContextMoveToPoint(ctx, 0, 0);
        for(NSInteger *i  in profits)
        {
             CGContextAddLineToPoint( ctx, 10, [i intValue]);
        }
        CGContextStrokePath(ctx);
    }