将CPTGraphHostingView添加为子视图 [英] Adding CPTGraphHostingView as a subview

查看:76
本文介绍了将CPTGraphHostingView添加为子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对此没有很多问题,也没有一个可以解决我的问题的方式得到回答,如果我要的是已经问过的问题,仍然感到抱歉.

There isn't a lot of questions about this and none of them were answered in a way that could solve my problem, still sorry if I'm asking something that was asked already.

我的问题是我想使用核心图在视图内绘制图形.因此,我在appviewcontroller.xib中将IB上的视图添加到IB中,但随后找不到如何将我在IB上定义的特定区域链接到文件的所有者.

My problem is that I'd like to use core plot to draw a graph inside a view. So I add the view on IB in my appviewcontroller.xib , but thenI can't find how to link that specific zone I just defined on IB to the file's owner.

有点精确:我设法在另一个应用程序中使用核心图,当时它是主视图,但是现在我想将其添加到现有应用程序中,因此现有视图不起作用.

A bit of precision: I managed to use core plot in another application, when it was the main view, but now that I want to add it to an existing application, so an existing view, it doesn't work...

要添加新区域,我刚进入IB,并将一个视图从对象库拖到我的appviewcontroller.xib中.

And to add the new zone, I just went into IB, and dragged a view from the objects library onto my appviewcontroller.xib.

那么如何将特定视图链接到我为此编写的代码?

So how do I link that particular view to the code I wrote for it ?

感谢您的帮助!

推荐答案

在情节提要(xib文件)的主视图(默认视图为视图)中创建另一个视图(视图2),并确保它(视图2) )作为头文件(.h)中的出口.

Create another view(view 2) in a main view(default view let it be view)in the storyboard(xib file) and make sure it (view 2) as outlet in the header file(.h).

将其拖动并连接到情节提要(xib文件)中新创建的视图,因此在情节提要中进行必要的连接后,情节提要应如下所示:

Drag and Connect it to the newly created view in the storyboard(xib file) so after making necessary connections in the storyboard,storyboard should be like this:

视图-视图(默认视图连接到视图)和 视图2 ---视图(新视图,视图2连接到其视图).

View---view (default view connected to view) and view 2---view (new view, view 2 connected to its view).

在实现文件的loadView方法中,尝试以下代码

In the loadView method of implementation file,try out these code

-(void)loadView {
    [super loadView];

    newView = [[CPTGraphHostingView alloc] initWithFrame: [[UIScreen       mainScreen]applicationFrame]];

    [self.view2 addSubview:newView];

}

这篇关于将CPTGraphHostingView添加为子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆