Android Developer Android Developer - 8 months ago 48
Objective-C Question

How to get numeric value from text field?

in Xcode 7.2 I set Keyboard type as Number Pad for UITextField. But when I try to read the value from the text field means app get crashed. I used following code to read the integer value.

int amount = [_amount.text intValue];

I googled and found same as suggested solution. Can anyone help me to solve this. Thanks in advance.

Answer Source

Please try this it will works for me.

int amount = [_amount.text integerValue];