Generally:
Is it OK to add a UITableView
as a subview of another UITableView
? Or, should I create a UIView
and add each UITableView
to it?
Specifically:
For a ComposeTableViewController
with a typeahead, like in the iPhone's native Mail app, which approach would you recommend and why?
Note: I prefer to construct things 100% programmatically (no Interface Builder).
Subclass
UITableViewController
.Then, to show the typeahead results, create and add a
resultsTableView
as a subview ofself.tableView
positioned directly underneath the the cell (ofself.tableView
) with the typeahead text field.The nice thing about this approach is that
resultsTableView
scrolls withself.tableView
automatically.But, is it OK to add a
UITableView
as a subview of anotherUITableView
?Subclass
UIViewController
.Create and add
tableView
(custom property) as a subview ofself.view
.Create and add
resultsTableView
also as a subview ofself.view
.The annoying thing about this approach is that I have to reposition
resultsTableView
manually anytimeself.tableView
scrolls.
I think I'd prefer approach 1, but adding a UITableView
as a subview of another UITableView
just seems smelly to me.