当我使用CPTPGraphHostingView [核心情节]时,背景ImageView是颠倒的(翻转) [英] Background ImageView is upside down(flipped) when I use CPTPGraphHostingView [Core plot]

查看:74
本文介绍了当我使用CPTPGraphHostingView [核心情节]时,背景ImageView是颠倒的(翻转)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iphone应用中使用核心情节1.0。一切正常,图形绘制完美,但我面临一个奇怪的问题,图形页面上的所有控件(CPTPGraphHostingView)都被镜像。

I am using core plot 1.0 in my iphone app. All works fine, graphs are drawing perfectly, But I am facing a weird problem that All the controls on graph page(CPTPGraphHostingView) are mirrored.

即:在那个xib文件上,我将顶级UIView的类ID设置为CPTPGraphHostingView,然后出现问题。

Ie: On that xib file, I set the class in class Identity of top UIView to CPTPGraphHostingView, then problem arises.

请帮我解决这个问题。控件在界面构建器中正确显示,但是当我运行项目时,所有操作都搞砸了。

Please help me how to solve this. The controls appear correctly in interface builder, but when I run the project all gets messed up.

即使我尝试以编程方式添加背景图像,但这也是镜像的。

Even I have tried to add background Image programatically, but that also is mirrored.

推荐答案

此答案的参考资料:

  • Core plot google group
  • Related SO question

我发现整个CPTPGraphHostingView倒置颠倒以支持Mac OS和iOS版。这是设计上的并且不是错误。

I came to know that the whole CPTPGraphHostingView is inverted upside down to support both Mac OS and iOS. This is by design and is not a bug.

所以给定链接的解决方案是:

So the solution from the given links is that:


  1. 向xib文件添加两个视图,类型 CPTPGraphHostingView (用于添加图表)和另一个类型 UIView (用于添加任何其他ui控件,背景等)。您可以通过在视图中的标题Class Identity 下修改类字段来修改View的类型标识选项卡 文件的所有者窗口

  2. 现在将图形添加到CPTPGraphHostingView并添加其他ui控件另一种观点(UIView)

  3. 故事结束

  1. Add two Views to your xib file, one of type CPTPGraphHostingView(for adding graph) and the other of type UIView(for adding any other ui controls, backgrounds etc). You can modify the type of View by modifying Class field under the heading Class Identity in View Identity tab of File's Owner window.
  2. Now add the graph to CPTPGraphHostingView and add other ui controls to the other view(UIView)
  3. End of story

更新:
如果将CPTPGraphHostinView添加到界面,则不会显示其他组件,因为您必须设置主题,并将CPTXYGraph填充为nil。即在初始化CPTXYGraph后添加以下行:

UPDATE: If you add CPTPGraphHostinView to interface, no other components will be visible, for that you'll have to set theme, and fill of CPTXYGraph to nil. Ie add following lines after you initialize your CPTXYGraph:

CPTTheme *theme = nil;
[barChart applyTheme:theme]; // barChart is my CPTXYGraph

barChart.fill = nil;
barChart.plotAreaFrame.fill = nil;

注意::添加CPTPGraphHostingView,使其成为顶级UIView的孩子,其他组件在顶级UIView中,而CPTPGraphHostingView则高于所有其他组件。

NOTE:: Add CPTPGraphHostingView such that it is child of top level UIView, and other components are in top level UIView, and CPTPGraphHostingView is above all other components.

这篇关于当我使用CPTPGraphHostingView [核心情节]时,背景ImageView是颠倒的(翻转)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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