2015-09-15 55 views
0

在我的表格视图中,我有多个标签显示成本产品。 enter image description here这样的,但是当我点击量按钮,我可以得到的数量值,但我不知道如何将多个与特定的细胞[数量按钮被按下它]的costlabel。如何使用该特定标签更改标签值?

这是我的代码: enter image description here

cell.lblCostPrice.tag=indexPath.row; 
    cell.btnQuantity.tag=indexPath.row; 

     [cell.btnQuantity addTarget:self action:@selector(quantityView:) forControlEvents:UIControlEventTouchUpInside]; 
currnentValues=[NSString stringWithFormat:@"%lu",[[arrGetProduct objectAtIndex:tagValue] integerValue]]; 
    cell.lblCostPrice.text=[NSString stringWithFormat:@"%@%@",[[arrGetProduct objectAtIndex:indexPath.row] valueForKey:@"price"],amount]; 

任何一个可以请帮我

在quanityView方法我能得到哪些量按钮被点击

 -(void)quantityView:(UIButton *)click 
     { 
      tagValue=click.tag; 

     } 

在这里,我获得数量值

- (void)popoverListView:(DDialogList *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 


    countQuantity=[[quantityArray objectAtIndex:indexPath.row] integerValue]; 
    [self.mTableView.tableView reloadData]; 
    [qtyView dismiss]; 
} 
+0

你能给我单元格的索引路径方法的行,所以我可以因为我认为你打开按钮点击选择器? –

+0

@JAYRAPARKA它不是一个选择器,这也是tableview,但弹出的方法是使用... –

+0

@JAYRAPARKA我编辑了我的代码,请检查.. –

回答

0

viewwithTag不上的UIViewController上的UIView的方法。你可能必须这样称呼它:

UILabel *label = (UILabel *)[self.view viewWithTag:71]; 
UILabel *label = (UILabel *)[self.view viewWithTag:71]; 
+0

UILabel * label =(UILabel *)[self.view viewWithTag:tagValue]; label.text = [NSString stringWithFormat:@“%lu”,total]; –

+0

我试着按照你的建议最后坠毁@Akash Raghani –