2015-09-15 97 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 –