I currently use a UITableViewController (PFQueryTableViewController), I would like to display a UIView over the top of the TableView.
Ideally I\'d like to do this in
You have to derive from UIViewController
to get full layout control.
Then simply add a UITableView
instance in Storyboard. Constrain it normally, edge-flush, top-flush, and have customView.top
= tableView.bottom
. Make a normal outlet to your controller.
You just need to remember to make your custom UIViewController
adopt the usual dataSource and delegate protocols, as well as assigning itself as those roles to the properties of the UITableView
on initialization (usually viewDidLoad()
).
There's one more finesse related to clearing the selected cell when on viewDidAppear()
, but there's nothing else special about a UITableViewController
-- it's just a UIViewController
with a built-in tableView
property and automatically assigned delegates and a very inflexible layout.
ADDENDUM based on comment about how to get around this: It's sort of like asking if there is any way to make a screwdriver drive a nail into wood. Just use the right tool. The top-level view
property of a UITableViewController
is the UITableView
itself. See below, a stock UITableViewController
with nothing else, zero code, in layout debug mode.
This means the entire tree of views is embedded in a scrolled entity, so all subviews will scroll with it.
It really shouldn't be that big a deal to re-do this one VC in Storyboard. After all, your rendering code in cellForRowAtIndexPath
and your dataSource and delegate generally, don't change at all.
ADDENDUM 2:
Not knowing Parse intimately, this may not be possible. (!! Thanks, Parse.) If Parse doesn't supply you with a separable PFQueryTableView
that you can embed yourself, the following workaround may be possible, but you'll need to understand the Objective-C code:
https://www.parse.com/questions/pfquery-tableview-for-uiviewcontroller