我想打印最后一个值的总和,但是下面的代码通过重叠打印显示标签中的所有值,所以我怎样才能只显示标签中的最后一个值总和
-(void)dataPrinting
{
int total=0;
for (int i = 0; i < [totalData count]; i++)
{
total +=i;
}
UILabel * lbl=[[UILabel alloc]initWithFrame:CGRectMake(100,75, 200, 60)];
lbl.text=[NSString stringWithFormat:@"%d",total];
lbl.font=[UIFont fontWithName:@"Arial" size:60];
lbl.textColor=[UIColor whiteColor];
lbl.backgroundColor=[UIColor clearColor];
[scrollView addSubview:lbl];
}