Monday 26 August 2013

How do I prevent more than 2 numbers after a decimal point in UITextField?

How do I prevent more than 2 numbers after a decimal point in UITextField?

Right Now I am making an app where the user is required to input a
currency value, decimal point optional, into a UITextField. My problem
comes up when I try to prevent more than 2 numbers after a given decimal
point while at the same time preventing more than one decimal point. I
have researched around the web and couldn't find an exact answer. I have
found that I will most probably need to use the
shouldChangeCharactersInRange, but I'm not sure how to use it exactly...
Thanks, Virindh Borra

No comments:

Post a Comment