Objective-c delegates entertain one instance at a time like if I have two view controllers and both implementing same delegate, but only currently presented view controller receive callbacks.
If I have a two uitableviews in same view controller both uitableview's delagates datasource are set like
tb1.datasource = self;
tb2.datasource = self;
tb1.delegate = self;
tb2.delegate = self;
How uitableview's working with delegates defined at same time?
Your delegate/datasource methods will be called twice, once for every table, and you can detect which table was called from:
For example:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == tb1)
return 10;
else if (tableView == tb2)
return 8;
}
That's the reason the caller tableView is passed as a variable in the methods, so you can detect where it's coming from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With