Im trying to send an alert if the value of a user input in a UITextfield goes above 1.67 times the value entered.
- (void)textFieldDidEndEditing:(UITextField *)textField
float x = ([_continuityRingFinalR2.text floatValue]);
float y = (1.67);
if ([_continuityRingFinalR2.text > x * y] )//errors here {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"My message here" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[alert show];
}
Im trying to say if _continuityRingCircuitR2.text is 1.67 times the users input show an alert. I think im nearly there but just keep getting errors on ([_continuityRingFinalR2.text x * y] )
Your error is likely because “
continuityRingFinalR2” is a label while the compiler is looking for some numeric value.Try using this:
(this answer assumes the value inside your label truly is a number)