问题
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