Take string from UITextField and use it as a double
I'm trying to make a unit converter as my first app. I've been having trouble getting the numeric value from the textfield, so I can multiply it by whatever constant to convert the units. Also, how ca开发者_运维问答n I add a decimal place to a numeric key pad?
Use the NSString doubleValue property to convert the string value from the UITextBox into a double.
double d = [str doubleValue];
float value = [self.myTextField.text floatValue];
精彩评论