동일한 루프에서 두 개의 다른 배열에서 값을 계산하고 선택하는 방법은 무엇입니까? 그텍스트 필드를 반복하는 방법 두 가지 다른 NSMUTABLEARRAY에서 인덱스는 동일합니다
예를 들어 같은
뭔가 :
for(UITextField *field in textFieldArray && textFieldArray2)
은 내가 값을 뺄하고 난 두 배열을 가지고 있고 나는 다른 배열하지만 같은 인덱스에서이 텍스트 필드의 값을 빼 할 ...
내 코드는
int result = 0;
for(UITextField *field in textFieldArray) // will iterate all UITextField which was added
{
result += [field.text intValue]; //or floatValue
}
NSLog(@"the result is %d", result); //here you have sum of all the text fields' text
내가이 빼기 싶지만 두 텍스트 필드
int y12 = ([Txt_New_Actual.text intValue]);
float c116 = y12-([Txt_New_Estimated.text floatValue]);
Txt_New_ONU.text = [[NSString alloc] initWithFormat:@"%.2f",c116];
대단히 감사합니다 alooot .... .... gr8888 도움말 ... –