开发者

How to get the indexPath of the particular table from multiple table in iphone

开发者 https://www.devze.com 2023-02-06 05:38 出处:网络
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 othe

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)
{
    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消