I have a UITableView with a Custom label in every cell. I want to be able to add up the total of every cell's label and display it in another label in the toolbar. Any help would be appreciated.
I create the label to be added like this in the cellForRowAtIndexPath:
Code:
Item *i = (Item *) [appDelegate.items objectAtIndex:indexPath.row];
thirdLabel = [[[UILabel alloc] initWithFrame:CGRectMake(246.0, 5.0, 43.0, 55.0)] autorelease];
thirdLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:25.0];
thirdLabel.textAlignment = UITextAlignmentCenter;
thirdLabel.adjustsFontSizeToFitWidth = YES;
thirdLabel.tag = 4;
thirdLabel.textColor = [UIColor blackColor];
thirdLabel.backgroundColor = [UIColor clearColor];
[cell.contentView addSubview:thirdLabel];
thirdLabel = (UILabel *)[cell viewWithTag:4];
thirdLabel.text = [NSString stringWithFormat:@"%i", i.need];
Thanks