In my iPad app storyboard design, there are two table views added.
One table view is for displaying the folder names and the other table view is for displaying the file names. When ever a folder table view cell is selected the files inside the selected folder needs to to be displayed in the other table view(the files table view).
My problem is
I am confused about
- How to add delegate and data source for each table view in
ViewController? or is it possible to add data source and delegates for each table view in a custom class other than ViewController ?
and
- How to handle the selection of cell ?
Please help !
First off: Why don’t you just display the files on a pushed viewController which takes up the whole screen? Seems more intuitive for me.
If you want to do it with two tableViews, and assuming they use dynamic cells than:
1, In the .h file of your view controller
specify two tableView properties like so:
implement the two delegate protocols of the UITableVIew
2, Add the two UITableViews onto your ViewController, and…
3, In the .m file of your ViewController implement the three datasource methods of UITableView like so:
4, Implement the selection:
Hope I got everything correctly. Don’t forget to
@synthesizethe properties in the .m file if you are using pre XCode 4.4.