Doug
Doug

Reputation: 869

Differentiate between Table Views

I have three table views inside a view controller (going to show/hide table views to display a list of options in different contexts)

Just wondering what the best way is to distinguish between different table views that are using the same delegate.

Thanks

Upvotes: 0

Views: 137

Answers (1)

DrummerB
DrummerB

Reputation: 40211

Use three separate instance variables in your view controller to store the table views. Then in the delegate methods you can do something like this:

if (tableView == myFirstTableView) {
    // Do whatever you need for table view 1.
} else if (tableView == mySecondTableView) {
    // Do whatever you need for table view 2.
}

Upvotes: 2

Related Questions