I have a UITextField that will contain the height value. I want to format the value of a field when a user enters text in a UITextField. for example, if I want to enter the value "5 feet 10", the stream will be:
1. Enter 5 2. " ft " is appended immediately after I type 5 with leading & trailing space.
My code is as follows:
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if ( [string isEqualToString:@""] ) return YES;
I am stuck at the point where I enter 5, nothing happens. I have to press any button to add "ft".
Can I do this without clicking anything?
source share