vburojevic vburojevic - 10 months ago 72
iOS Question

Is it possible to have two Table Views in one XIB?

I need to have two Table Views in one XIB file, is there any way to do that?

Answer Source

Another cleaner way to do is to add two different UITableViewController to the XIB and set it to different classes.

Two table view controllers

Your XIB should look like this. Instead of connecting the table view datasource and delegates to File's owner, you connect it to their own controllers.

This way, your code will be clean and easy to maintain. Later on if you want to move that table to a different view, it's very easy and can be done just by changing IB.