TextField text to float (Objective-C)

iphone, objective-c

Solution

`float myFloat = [[myTextField text] floatValue];`

Edit: technically the most proper way to do this would be to use an `NSNumberFormatter`, since that will return a `nil` `NSNumber` if it can't parse the string properly, whereas `floatValue` will just return 0.0 for a malformed string. But `floatValue` is usually adequate for most purposes.

Problem

How do I convert the text inside of a TextField to a float in Objective-C?

Original source