我现在需要一个frame上同时显示多个图表,但是我用subview的时候,程序就crash了,直接用self.view没事,这是为什么?我跟踪了一下也没发现什么问题?有谁这么用过?求指点。
代码如下UIView *subv = [self.view.subviews objectAtIndex:0];
graph = [[CPTXYGraph alloc] initWithFrame:subv.bounds];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)subv;
hostingView.hostedGraph = graph; //这一行报错了。-------下面这个直接用self.view不报错
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.hostedGraph = graph;
代码如下UIView *subv = [self.view.subviews objectAtIndex:0];
graph = [[CPTXYGraph alloc] initWithFrame:subv.bounds];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)subv;
hostingView.hostedGraph = graph; //这一行报错了。-------下面这个直接用self.view不报错
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.hostedGraph = graph;
解决方案 »
- 手机开发项目--求助急!
- 那位大深帮忙解决一下iphong编程时出错了,这是哪儿出错了怎么解决 啊
- XCode4.3.2安装后找不到Interface builder,请问XCode4.3.2如使用Interface builder?
- 我开发出来的软件如何发布到app stores里面去,让更多的人能下载
- 急救!!两天了,还冒解决,哪位救救我啦!
- iphone 通过safari获取本机号码
- 跪求MacOSX10.4u.sdk.rar 下载地址
- 请问满屏显示怎么调整大小适配各种苹果版本
- ios8.1.2能降级到ios7吗?
- https验证服务器证书bug、请大神帮忙(用的是AFNetworking3.0)
- UITableViewCell的问题
- 小小问题,求助一下
让一个控制器控制多个子视图(CPTGraphHostingView)就行了
谢谢,可以加载进来了,但是CPTGraphHostingView是反的,可以把它设置过来吗?
怎么会是反的啊?我用的都是正的啊。CPTGraphHostingView的坐标系原点在左下角,UIView的坐标系原点在左上角,你是不是这个弄混了?
我是在一个UIviewcontroller里面添加了一个CPTGraphHostingView和一个分段控件,CPTGraphHostingView来显示图,分段控件来切换(折线图、柱状图、饼图),CPTGraphHostingView里面是加载的其它的UIviewcontroller控制器(这里面才是画的图)
你说的一个视图控制器加几个CPTGraphHostingView,但是折线图和柱状图都创建到一个视图控制器里面-【- ( double *)doublesForPlot:( CPTPlot *)plot field:( NSUInteger )fieldEnum recordIndexRange:( NSRange )indexRange】这个方法,生成折线图是不会报错,但是一加上柱状图,就报错了,应为折线图和柱状图在里面的处理方法不一样,我不知道柱状图时这个方法里面是怎么处理的