简体   繁体   English

如何将PFQueryTableViewController放入UIViewController iOS Swift

[英]How to Put PFQueryTableViewController Inside UIViewController iOS Swift

I want to put a PFQueryTableViewController inside my class which is a UITableViewController but I'm having a hard time figuring out how. 我想在我的类中放一个PFQueryTableViewController,它是一个UITableViewController,但是我很难弄清楚该怎么做。 I need this setup because my UIViewController is going to have a textview and button which need to be outside the table view not inside of it. 我需要此设置,因为我的UIViewController将具有一个textview和一个按钮,该按钮必须位于表视图之外,而不位于其内部。 I also need the data in the table view to load as soon as my UITableViewController gets segued into. 一旦我的UITableViewController被固定,我还需要在表视图中加载数据。 Any one know how to do this? 有人知道怎么做吗?

So what you could do is the following: 因此,您可以执行以下操作:

  1. Insert a view within a view with something like this 这样在视图中插入视图

  2. The second view, define it as PFQueryTableViewController 第二个视图,将其定义为PFQueryTableViewController

  3. Make a segue between the two. 在两者之间进行对话。
  4. Have a prepareForSegue() function pass the values of the button and textview of the parent view to the smaller child view or vice versa. 让prepareForSegue()函数将父视图的按钮和textview的值传递给较小的子视图,反之亦然。

perhaps this could end up being useful. 也许可能最终有用。

Note: There's probably a more efficient and elegant solution out there, but based on what you described you want to do, this seems like a "hack" way to achieve it. 注意:那里可能有一个更有效,更优雅的解决方案,但是根据您所描述的要执行的操作,这似乎是实现这一目标的一种“ hack”方式。 I'd suggest try to implement it and then find other ways that could be more efficient. 我建议尝试实施它,然后找到其他更有效的方法。

As for how to make sure your data is loaded into the table when segued into, this tutorial could prove useful. 至于如何确保在装入数据时将其加载到表中, 本教程可能会很有用。

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

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