【问题标题】:I added ScatterPlot View But I can not See it on Page我添加了 ScatterPlot 视图但我在页面上看不到它
【发布时间】:2013-02-15 08:18:26
【问题描述】:

我有一个像这样的散点图类:

@interface myCPTScatterPlot :  UIView <CPTPlotDataSource , CPTScatterPlotDelegate ,    CPTScatterPlotDataSource>

@property (nonatomic, assign) CPTGraphHostingView *hostView;

-(void) initAll;
-(void) configureHost;
-(void) configureGraph;
-(void) configurePlots;
-(void) configureAxes;

@end

我实现了所有的配置功能。我创建了一个图表并将其添加到主机中: self.hostView.hostedGraph = 图;

我很好地实现了 myCPTScatterPlot.mm 文件。

我在 myCPTScatterPlot.mm 文件中有一个 initWithframe 函数,例如:

-(id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        hostView = [(CPTGraphHostingView *) [CPTGraphHostingView alloc] initWithFrame:frame];
    }
    return self;
}

最后,我有一个 pageView.mm 文件,并将所有页面对象添加到我的 page.view 中

[(UIView *)page performSelectorOnMainThread:@selector(addSubview:) withObject:firstScatterPlot waitUntilDone:YES];

但我看不到我的图表:(

我错过了什么?

【问题讨论】:

    标签: ios objective-c core-plot scatter-plot


    【解决方案1】:

    好的,我做到了。我要添加到视图(页面)中的元素对象应该是 CPTGraphHostingView。 一切都会好起来的。

    [(UIView *)page performSelectorOnMainThread:@selector(addSubview:) withObject:firstScatterPlot waitUntilDone:YES];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-20
      • 2021-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-16
      相关资源
      最近更新 更多