I have a UIViewController
that should be capable of displaying tableView
s with multiple data sources. The UITableView
spans about half the size of the screen, and there is and up and down button that allows you to go through different data. Everytime the up and down button is hit, I'd like to ultimately use UIViewAnimationTransitionCurlDown
or something sim开发者_如何学编程ilar to display the next UITableView
.
The question is: do I need multiple UIViewControllers
to do this, with a tableView
embedded in each one? Should I just create one instance of UITableView
and change its data source when an up or down button is hit? If it's only one instance of UITableView
, how do I manage to get a curl transition over the portion of the screen it takes up to make it look like a new tableView
is coming in?
Why not have each table view belong to its own UITableViewController
, and nest these within the current screen's view controller? This way the screen's view controller is responsible for swapping out its subviews, each of which have a table view controller containing the necessary logic to show their data.
In the end, it comes down to what your functionality and data sets look like. It may end up being easier to implement the table view datasource & delegate code once, injecting an actual data source into this class - or it may be easier to write custom datasource code for each table view.
精彩评论