简体   繁体   English

如何将UIView添加到CorePlot视图?

[英]How to add UIView to the CorePlot view?

I have a UIView for CorePlot and I want to add UIView under the plot as a subview. 我有一个用于CorePlot的UIView,我想在该图下添加UIView作为子视图。 I have tried this: 我已经试过了:

[self.view bringSubviewToFront:_viewTable];

But it doesnt work. 但它不起作用。 How can I make it work? 我该如何运作?

EDIT: 编辑:

My Storyboard: 我的故事板:

在此处输入图片说明

Green - firstPieChartView (CorePlot view) 绿色-firstPieChartView(CorePlot视图)

Red - UIview with tableView 红色-带有tableView的UIview

In viewDidLoad: 在viewDidLoad中:

[self.firstPieChartView addSubview:_viewTable];
  [self.firstPieChartView bringSubviewToFront:_viewTable];

You are bringing the view to front by this, not adding it as a subview. 您是通过这种方式将视图置于最前面,而不是将其添加为子视图。 First you have to use: 首先,您必须使用:

[self.view addSubview:yourSubview];

--in order to add it. -为了添加它。 Then you can bring it to front, if you're overlaying it with other subviews. 然后,如果将其与其他子视图叠加,则可以将其置于最前面。

Do not add subviews to a Core Plot hosting view. 不要将子视图添加到Core Plot托管视图。 The iOS hosting view applies a flip transform to its children so Core Plot can share drawing code with the Mac version. iOS托管视图对其子级应用了翻转变换,因此Core Plot可以与Mac版本共享绘图代码。 Instead of making your view a subview of the hosting view, make them siblings (ie, children of the same parent view). 不要让您的视图成为托管视图的子视图,而应使它们成为同级(即,具有相同父视图的子视图)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM