I have a general question regarding UITableViews.
here is my situation.
I have a view with a couple of buttons and a UITableView, by pressing a button, the UITableView’s Content should change. I use Custom Table Cells (the same cells in every seperate table) but of course with different content.
I’m not sure if It is good practice to define 3 UITableView instances within my view and to switch between those when clicking a button.
also i don’t know what my program should do when one of the buttons is pressed (destroy the old view? how to set a new view? overlay the new vie over the old? and then how to get the old one back once another button is pressed)…
as you see, lots of rather general questions.. maybe i was searching the wrong way, but i couldn’t find an article on the web that would provide me with the necessary information.
thank you for your reply!
greets
sam
I really depends on both how you’re transitioning between the tableviews, and their styles. If you don’t have any sort of animation when switching tables, and they’re all the same size, then I’d recommend using a single view, and doing what you have to do within your delegate/dataSource methods. If you’re showing ‘table 1’, return one set of data, and ‘table 2’, another.
If, however, the tables are different styles (grouped vs. plain), you’ll need to have different views. Also, if you’re animating one table out while another is coming it, you’ll need multiple views. Just layout three tables in IB, but set two of them to ‘hidden’. When it’s time to switch, hide the currently visible table and show the new one. Alternatively, you could use +[UIView beginAnimation:context:] to fade the old one out and the new one in.