ios - 我添加了 ScatterPlot View 但我无法在页面上看到它

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

我有一个散点图类:

@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];

但是我看不到我的图表:(

我错过了什么?

最佳答案

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

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

关于ios - 我添加了 ScatterPlot View 但我无法在页面上看到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14890583/

相关文章:

ios - 在 UIPageViewController 中嵌入 UIScrollView 并禁用 pageView 滑动?

iphone - 使用用户方向旋转 MKmap

ios - 在我的应用程序中获取其他应用程序图标图像

iPhone : How to change gradient color for negative values in Core Plot?

iphone - 核心图 - 用颜色填充坐标之间的特定区域

iphone - 在 iPhone SDK 中绘制图形有哪些 Core-Plot 的替代方法

ios - 优化技巧 (THEOS)

ios - ResearchKit 中的安全文本输入 ORKAnswerFormat

ios - 使用自动布局调整 subview 的大小

objective-c - Objective C 的代码检查