How to make a PFQueryTableView work inside a UIViewController

冷暖自知 提交于 2020-01-06 12:47:39

问题


I'm trying to figure out how to get the benefits of the PFQueryTableViewController to work inside of a a regular UIViewController that has a TableView embedded in it. Because apparently I can't load data from parse onto my TableView. It just pops up as a blank tableView with none of my information from Parse in it unless the code is ran on a UITableViewController, then it has no problems. But I'm trying to get my program to run on a Table View thats in a UIViewController. And whenever I change the @Interface from- @interface MainWall: UIViewController to @interface MainWall :PFQueryTableViewController, the app crashes.

So my question is, is there anyway around this? I read a little about subclass, subviews and Container View Controller but no one actually showed how to create them besides Parse's AnyWall code, which was extremely confusing.


回答1:


You are correct in that you will have to use a container view controller. Here is a good link with a container view tutorial




回答2:


If you're seeking Parse's table view controller they provide, use this: PFQueryTableViewController (not just a "PFQueryTableView", which I believe does not exist in the framework)

Otherwise, you must handle the data fetching and everything yourself, which does not diverge much from what you would normally do in a PFQueryTableViewController except that you have to get your data in viewDidLoad and store the array of PFObjects.

However you could also use containers and put a PFQueryTableViewController inside another view controller, but never the less I find that handling Parse data fetching, etc. in my own view controller is better for the versatility I can achieve.



来源:https://stackoverflow.com/questions/28080605/how-to-make-a-pfquerytableview-work-inside-a-uiviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!