The code showing here assigns the value of an variables to the text field I want to do the opposite of that. _Initial.text = [NSString stringWithFormat:@"%f", init];

The opposite of the code above. Please help

2

There are 2 best solutions below

0
On BEST ANSWER

The opposite of that would be getting converting string to float. You can do it with this

init = [_Initial.text floatValue];
1
On

You should search for an answer before you ask a question.

NSString *intString = @"123";
NSString *floatString = @"456.789";
int intVal = [intString intValue];
float floatVal = [floatString floatValue];
printf("%i %f\n",intVal,floatVal);