I’m getting a message “NAN” within the UITextField when i’m trying to calculate the percentage of two UITextFields. My current code is as follows:
float firstFloat = [self.tex15.text floatValue];
float secondFloat = [self.tex16.text floatValue];
float answer = secondFloat / firstFloat * 100;
self.tex20.text = [NSString stringWithFormat:@"%.1f%%",answer];
I strongly suspect it’s an issue with your IBOutlet connections. The following code works fine for me: