问题描述
我真的很感动,并且非常感谢我上次在这里问到的答案。
I was really impressed, and really grateful about the answers I recived last time I asked here.
我对Core Plot有这个问题。
我想在我的UIView中有一个CPTGraphHostingView,所以我可以在它下面有标签和滚动视图等东西。
I have this problem with Core Plot.I want to have a CPTGraphHostingView inside my UIView so I can have things like labels and scroll views below it.
顺便说一句,我正在使用XCode 3.2。
I am using XCode 3.2 by the way.
如何以编程方式执行此操作?或者尽可能使用接口构建器。(我需要详细说明,因为我对这类事情不熟悉)
感谢您的支持。
How do I do this programmatically? Or with the Interface builder if possible.(I need the instructions to be detailed as im I bit new to this sort of thing)Thanks for your support.
推荐答案
如果要将核心绘图图形添加到UIView,则必须将CPTGraphHostingView作为子视图添加到UIView。在下面的示例中,hostingView是一个UIView,graphObject是一个CPTXYGraph。
If you want to add a core plot graph to a UIView you have to add a CPTGraphHostingView as a subview to the UIView. In the example below, hostingView is a UIView and graphObject is a CPTXYGraph.
CPTGraphHostingView *graphHostingView = [[CPTGraphHostingView alloc] initWithFrame:hostingView.bounds];
[hostingView addSubview:graphHostingView];
graphHostingView.hostedGraph = graphObject;
这篇关于UIView中的CPTGraphHostingView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!