开发者

Take string from UITextField and use it as a double

开发者 https://www.devze.com 2023-03-09 06:15 出处:网络
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

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消