如何在手机上制作核心情节图,不会自动展开以填充整个超级视图

时间:2021-03-22 12:34:49

I'm pretty sure I saw an example where the graph wasn't filling the whole iPhone screen, but I can't get that to happen in my app, nor in the Core-Plot Test app from Switch On The Code.

我很确定我看到了一个示例,其中图表没有填满整个iPhone屏幕,但我无法在我的应用程序中实现这一点,也无法在Switch On The Code的Core-Plot Test应用程序中实现。

I've added a subview to the original CPLayerHostingView in the sample, then changed the classes – original back to UIView, new subview to CPLayerHostingView, and I've reconnected the File's owner's view outlet to the new subview.

我在示例中为原始CPLayerHostingView添加了一个子视图,然后将类更改为原始版本返回到UIView,将新子视图更改为CPLayerHostingView,并且我已将文件所有者的视图插座重新连接到新的子视图。

When I create a graph with:

当我用以下内容创建图表时:

graph = [[CPXYGraph alloc] initWithFrame: theSubviewOutlet.bounds];

… and step through the first stages of building up the layers the bounds are accurate (i.e. the same as in the .xib)

...并逐步完成构建图层的第一阶段,边界是准确的(即与.xib中的相同)

however, when all the initialization is done, and the graph shows up, it fills the whole superview.

然而,当完成所有初始化并且图形显示时,它将填满整个超级视图。

Am I missing something obvious?

我错过了一些明显的东西吗

1 个解决方案

#1


1  

These types of questions are better asked on the core plot mailing list, because we may miss them over here.

在核心情节邮件列表中更好地询问这些类型的问题,因为我们可能会在这里错过它们。

There is nothing special about a CPLayerHostingView. You should be able to add it as a subview to your UIView, and resize it as you wish. You should also be able to set springs and struts in interface builder, or via code.

CPLayerHostingView没有什么特别之处。您应该能够将其作为子视图添加到UIView中,并根据需要调整其大小。您还应该能够在界面构建器中或通过代码设置弹簧和支柱。

Perhaps you have your parent UIView setup to resize subviews in some way? In any case, Core Plot should not be doing anything to modify the host view frame.

也许您的父UIView设置以某种方式调整子视图的大小?在任何情况下,Core Plot都不应该做任何修改主机视图框架的操作。

#1


1  

These types of questions are better asked on the core plot mailing list, because we may miss them over here.

在核心情节邮件列表中更好地询问这些类型的问题,因为我们可能会在这里错过它们。

There is nothing special about a CPLayerHostingView. You should be able to add it as a subview to your UIView, and resize it as you wish. You should also be able to set springs and struts in interface builder, or via code.

CPLayerHostingView没有什么特别之处。您应该能够将其作为子视图添加到UIView中,并根据需要调整其大小。您还应该能够在界面构建器中或通过代码设置弹簧和支柱。

Perhaps you have your parent UIView setup to resize subviews in some way? In any case, Core Plot should not be doing anything to modify the host view frame.

也许您的父UIView设置以某种方式调整子视图的大小?在任何情况下,Core Plot都不应该做任何修改主机视图框架的操作。