Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JefRH1

macrumors newbie
Original poster
Aug 17, 2008
10
0
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {

I have two UITableView's on the same screen. Both go through the routine above. How can I use 'tv' and test which one is currently being passed?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Assuming you have kept references to the two table views in instance variables simply check if they are the same:

Code:
@interface MyClass
{
UITableView *tableView1;
UITableView *tableView2;
}
@end

@implementation MyClass

// Assume that tableView1 and tableView2 are either programatically setup or are IBOutlets and linked in interface builder

- (UITableViewCell *)tableViewUITableView *)tv cellForRowAtIndexPathNSIndexPath *)indexPath {
if (tv==tableView1)
{
// Do table view 1 here
}
}
@end
 

JefRH1

macrumors newbie
Original poster
Aug 17, 2008
10
0
oooooook

Wow I think I need some sleep. That was to easy.

Thanks for the prompt reply
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.