代码之家  ›  专栏  ›  技术社区  ›  sashaeve

iPhone绘图/图表库

  •  0
  • sashaeve  · 技术社区  · 15 年前

    我正在寻找一个好的绘图库(线,饼,柱形图),它允许与用户接触,如股票应用程序。

    我发现了一个核心的绘图库,但似乎交互逻辑没有被很好地覆盖。

    请建议可以使用哪些库?

    1 回复  |  直到 15 年前
        1
  •  0
  •   sashaeve    15 年前

    解决了问题。

    交互逻辑包含在 CPLayerHostingView.m 文件。

    如果您需要将 ViewController 具有 CPLayerHostingView ,只需添加属性:

    @interface CPLayerHostingView : UIView<CPPlotDataSource> {
    @protected
        CPLayer *hostedLayer;
        CPTestAppScatterPlotController *touchController;
    }
    
    @property (nonatomic, readwrite, retain) CPLayer *hostedLayer;
    @property (nonatomic, readwrite, retain) CPTestAppScatterPlotController *touchController;
    

    然后在 可视控制器 使用代码:

    CPLayerHostingView *hostingView = (CPLayerHostingView *)self.view;
    hostingView.touchController = self;
    

    所以现在您可以从视图中运行任何控制器的视图方法。