ios coreplot设置

问题描述:

很难让CorePlot在我的项目中工作,但现在一切都运行了。除了空白的白屏,我只是没有看到任何其他内容。ios coreplot设置

用下面的代码,我不应该至少这样一个空白图吗?

self.graph = [[[CPTXYGraph alloc] initWithFrame:frame] autorelease]; 
layerHostingView.hostedGraph = graph; 

[self addSubview:layerHostingView]; 

感谢帮助我这。

FYI这不是我的第一次测试coreplot。这几天我一直在旋转我的车轮,并且尝试了每一个我可以得到的完整例子。我认为从基础开始重新开始是个好主意。

所不同的是,你在你的答案发布的代码,您创建了一个CPTGraphHostingView并添加它作为RaceDetailView的子视图。在你的问题的代码中,我怀疑托管视图是零。我不认为添加主题会有所作为 - 默认外观是带有黑色线条和标签的简单白色背景,您仍然可以看到某些内容。

+0

我真的不知道真正的答案,我太无兴趣弄清楚它是什么。不过,我觉得给你答案比给我更好。知道你会从中得到更多的分数是更大的好处! – Jacksonkr 2012-02-18 22:44:30

我真的不知道什么改变了,但我看到一个赤裸图与此代码。

.H

#import <UIKit/UIKit.h> 
#import "CorePlot-CocoaTouch.h" 

@interface RaceDetailView : UIView <CPTPlotSpaceDelegate, CPTPlotDataSource, CPTScatterPlotDelegate> 

@end 

.M

#import "RaceDetailView.h" 

@implementation RaceDetailView 

- (id)initWithFrame:(CGRect)frame 
{ 
    self = [super initWithFrame:frame]; 
    if (self) { 
     CGRect f = self.frame; 
     CPTXYGraph *graph = [[[CPTXYGraph alloc] initWithFrame:f] autorelease]; 
     CPTGraphHostingView *layerHostingView = [[CPTGraphHostingView alloc] initWithFrame:f]; 
     layerHostingView.hostedGraph = graph; 
     [graph applyTheme:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; 

     [self addSubview:layerHostingView]; 
    } 
    return self; 
} 

@end 
+1

哇,老兄,我有同样的问题,应用主题工作! – JomanJi 2013-09-27 14:53:41