i want to sum to values which i get from a textfiel. how can i cast a textfield value in double value ?
Regards Caglar
i want to sum to values which i get from a textfiel. how can i cast a textfield value in double value ?
Regards Caglar
See this question: http://stackoverflow.com/questions/169925/how-to-do-string-conversions-in-objective-c
double myDouble = [myTextField.text doubleValue];
You can use doubleValue
to convert a NSString (from your text field) to a double like so:
double myDouble = [myTextField.text doubleValue];
This isn't a cast, by the way, it's a conversion. The doubleValue
method performs a conversion from a string to a double representation. Casts are something you can only perform on primitive numeric types or pointers in Objective-C.