Hi i m using 2 tables in a single view and want to get the indexpath of the tables. I use the below code to get the indexpath. but stil categoryId getting effected whatever table i access not the other thing. Please help...
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tableView=categoryTblView)
{
categoryId=indexPath.ro开发者_如何学运维w;
NSLog(@"categoryId=%d",categoryId);
}
else if(tableView=regionTblView)
{
regionId=indexPath.row;
NSLog(@"regionId=%d",regionId);
}
}
To test equality here, you need to use ==
instead of a single equal sign (which is for assignment).
So the code should be:
if (tableView == categoryTblView)
{
...
}
else if (tableView == regionTblView)
{
...
}
精彩评论