开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜