如何在循环中计算文本字段?我在循环中有一个文本字段,我想计算另一个文本字段中的输入。
x = 36; y = 0; w = 36 h = 25 ;
moretext = 0 ;
for (moretext=0; moretext<5; moretext ++) {
textFiled1 = [[UITextField alloc]initWithFrame:CGRectMake(x, y, w, h)];
textFiled1.textAlignment = NSTextAlignmentCenter;
textFiled1.backgroundColor = [UIColor clearColor];
textFiled1.font = [UIFont fontWithName:@"Helvetica " size:(8)];
x+=36 ;
[self.view addSubview:textFiled1];
}
我想在 textfield2 中显示 textfield1 循环输入的 TOTAL
textFiled2 = [[UITextField alloc]initWithFrame:CGRectMake(180, 0, 36, 25)];
textFiled2.textAlignment = NSTextAlignmentCenter;
textFiled2.backgroundColor = [UIColor clearColor];
textFiled2.font = [UIFont fontWithName:@"Helvetica " size:(8)];
[self.view addSubview:textFiled2];