This is more of a requirement than a problem.
There is a tab bar controller, in one of the controllers of the tab bar controller there is a nav controller. Below it there is a segment control, I have to display some data(which I’ll get thru URL connections) in table view. On changing of segment from the segment control the content of the table will change. And the segment control changes the type of data being displayed in the table and even there UITableViewCells are different. All the three segments will display data in the table.
One possible solution is to change the data and reload the table when the segment is changed.
Other solution is to change the views (will have three different view controllers) on changing the segments and these view controllers will implement there own table delegates and will have independent table views.
First one is more efficient I suppose. Second one will keep everything(code) separate of the different segments. There are some issues though, the navigation controller is not accessible in the inner view controllers.
Can any one suggest me the best possible solution for the same?
Thanks in adv.
I looked into this quite a lot and eventually plumped for changing the data source of a single TableView. I only had two segments, cell types, fetchedResultsControllers etc. and it still made for a pretty heavy custom TableViewController. Lazy loading images, if you need to do that, is also a bit of a pain.
I didn’t need to have a handle on the navigation controller for the individual table views but if that’s important to you, perhaps the second approach is best. Despite the above, the first approach works pretty well having got it down. Interested in hearing any better patterns for though.