Pre-populate formatted phone text field
petec029 opened this issue · 3 comments
petec029 commented
How do I pre-populate a phone formatted text field with a phone number I am storing online without any formatting characters?
For example userObj.phone = "2125551212"
When I try the following in viewDidLoad
phoneTextField.mask = @"(###) ###-####";
phoneTextField.text = userObj.phone;
My screen displays 2125551212
When I try
phoneTextField.mask = @"(###) ###-####";
[phoneTextField shouldChangeCharactersInRange:NSMakeRange(0, phoneTextField.text.length) replacementString:userObj.phone];
My screen displays
(125) 121-2125551212
viniciusmo commented
Thanks man,
I will fix it.
petec029 commented
Did you come up with a fix for formatting a pre-populated phone number text field?
viniciusmo commented
Please use this method setTextWithMask available in version 1.0.4