2013-02-15 44 views
1

我有一个散点图类,如:我加散点图的看法,但我无法看到它的页面

@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 = graph;

我实现了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]; 

但我看不到我的图:(

我缺少什么?

+0

Ağlamalan :) :) – 2013-09-11 08:45:19

回答

1

好吧,我二叔d it。我想添加到视图(Page)中的元素对象应该是CPTGraphHostingView。 比一切都会好起来的。

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