ios核心图设置

标签 ios core-plot

很难让 CorePlot 在我的项目中工作,但现在一切都可以运行。除了空白的白色屏幕,我什么都看不到。

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

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

[self addSubview:layerHostingView];

感谢帮助我解决这个问题。

仅供引用,这不是我第一次使用 coreplot 进行测试。几天来我一直在研究这个问题,从那以后我尝试了所有我能得到的完整例子。我认为从基础开始重新开始是个好主意。

最佳答案

老实说,我不知道发生了什么变化,但我看到了一个包含这段代码的裸图

.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

关于ios核心图设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9297194/

相关文章:

ios - 从 google api 获取 EN、IT、FR、DE、ES 本地化城市名称

ios - 显示 AFNetworking+UIImageView 占位符图像,但不显示 URL 图像

ios - Swift 在不知道类型的情况下转换泛型

ios - 在工作区中向现有项目添加核心图框架时出现问题

objective-c - 为 CorePlot 制作 NSDecimal

iphone - 核心图 - 禁用 y 方向的缩放和滚动,而不是 x

ios - 在核心情节1.0中如何清除情节

ios - 如何使用本地设备 Facebook 登录 Meteor?

ios - 使用 AutoLayout 将 UIView 调整为离散值

ios - 核心图不缩放