添加 CPTGraphHostingView 作为子视图
关于此的问题并不多,而且没有一个能够以可以解决我的问题的方式得到回答,如果我问的是已经被问过的问题,仍然很抱歉。
我的问题是我想使用核心图在视图内绘制图表。因此,我在 appviewcontroller.xib 中添加了 IB 上的视图,但随后我找不到如何将我刚刚在 IB 上定义的特定区域链接到文件的所有者。
一点精确:我设法在另一个应用程序中使用核心图,当时它是主视图,但现在我想将它添加到现有应用程序中,因此现有视图不起作用......
并且添加新区域后,我刚刚进入 IB,并将对象库中的视图拖到我的 appviewcontroller.xib 上。
那么如何将该特定视图链接到我为其编写的代码呢?
感谢您的帮助!
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.
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...
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 ?
Thanks for any help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须将创建的 uiview 添加到 self.view,然后向其中添加图形托管视图...
试试这个
U have to add uiview created to self.view,then add graph hosting view to it...
Try this
在故事板(xib 文件)的主视图(默认视图为视图)中创建另一个视图(视图 2),并确保它(视图 2)作为头文件(.h)中的出口。
将其拖动并连接到故事板(xib 文件)中新创建的视图,因此在故事板中进行必要的连接后,故事板应如下所示:
View---view (默认视图连接到视图)和
视图2---视图(新视图,视图2连接到它的视图)。
在实现文件的
loadView
方法中,尝试一下这些代码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).
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:
View---view (default view connected to view) and
view 2---view (new view, view 2 connected to its view).
In the
loadView
method of implementation file,try out these code