FloatingTextField-PhoneFormatter
is the JVFloatLabeledTextField joined with SHSPhoneComponent.
You can turn on/off the phone number formatter for a JVFloatLabeledTextField
through Interface Builder or Code.
It implements IB_DESIGNABLE
and IBInspectable
so you can fully customize it in Interface Builder.
Copy /FloatingTextField+PhoneFormatter/Library folder to your project.
And import JVFloatLabeledTextField.h
in your Controller.
- Add
UITextField
on yourUIViewController
- Change
UITextField
class toJVFloatLabeledTextField
- Customize your field:
JVFloatLabeledTextField* phoneField = [[JVFloatLabeledTextField alloc] initWithFrame:frame];
[self.view addSubview: phoneField];
phoneField.phoneNumberField = YES;
phoneField.placeholder = @"Phone number";
[phoneField.formatter setDefaultOutputPattern:@"(###) ###-##-##"];
phoneField.formatter.prefix = @"+7 ";
You can find more about the phone formatter on the owner page
Through the Demo project you can find out how it works, and tune it as you wish:
ARC Enabled. iOS 7+