Question

I need some help.

I've got a segmented control. if segment 0 is clicked it shows a UIView, containing a uitableview. If segment 2 is clicked it shows another UIView which contains a uitableview as well.

These two tableviews got the same datasource. But i want the second tableview to have an other datasource. SO i thougth of loading another nib into the second uiview containing a the tableview which gets its data from the corresponding .m file.

I don't know wheather this is the best solution. If you've got any other ideas let me know :)

thanks in advance!

Was it helpful?

Solution

I think the best way to do this is to have just one table view. In the cellForRow method have a conditional which queries the state of the segmented control. Depending on the result of that if statement, return the type of cell you want. In addition, in your segmented control callback you'll have to do a [tableView reloadData]

OTHER TIPS

Do you know that you can have the same tableview display different data sets? You don' have to use an entirely different NIB just to change UITableViews so you can display different data. Or am I understanding your question incorrectly?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top