Quote:
Originally Posted by @@rz
I'm trying to sum the integers from five UITextFields and post them to a UILabel.
This is the code I have tried. It works to begin with, then it start to mess up! Sometimes it doesent work at all!! Really weird!
int val = [textfield1.text intValue]
val = val+[textfield2.text intValue];
val = val+[textfield3.text intValue];
val = val+[textfield4.text intValue];
val = val+[textfield5.text intValue];
NSString *labelStr = [[NSString alloc] initWithFormat:@"%i", val];
label.text = labelStr;[/b]
Something wrong with the code?? Alternatives maybe? Greatful for all answers!
|
No nothing wrong with the code. You have to be more precise in the description of your problem if you want help. "Starts to mess up"? How?
__________________
regards
Oliver Drobnik
Cocoanetics - Our DNA is programmed in Objective-C.
Linguan – makes localizing strings file fun!
Cocoanetics Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support. Check it out today!
|