Include Multiple Labels and change the value of the same in Iphone, Objective C

Posted by user576569 on Stack Overflow See other posts from Stack Overflow or by user576569
Published on 2011-01-15T08:19:14Z Indexed on 2011/01/15 10:53 UTC
Read the original article Hit count: 137

Filed under:
|
|

I m trying to insert label in each row of the cell. Displaying integer. and I m trying to increase the quantity if user click on button add or minus I able to insert button in UITableView Cell as well the function to change the value. But when I click on add button it changes value only for the last row and not on the specific row.

//MY code to insert label in each cell

txtQty = [[UILabel alloc] initWithFrame:CGRectMake(233,7,20,20)];

txtQty.text = [NSString stringWithFormat:@"%@",[nos objectAtIndex:indexPath.row]];

txtQty.tag = count;

txtQty.textColor =[UIColor whiteColor];

txtQty.backgroundColor = [UIColor clearColor];

[cell.contentView addSubview:txtQty];

//Button Creation

UIButton *button2 = [[UIButton alloc] initWithFrame:CGRectMake(180,5,30,30)];

[button2 addTarget:self action:@selector(subAddSubQty:) forControlEvents:UIControlEventTouchUpInside];

[button2 setTag:count];

[cell.contentView addSubview:button2];

now what happening is suppose there are 3 rows in table and I click on the 1st row add button the value gets change in the last label i.e at 3rd row and not of the 1st row How to solve these?? please help Thank You

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c