Skip to content

Nibelungc/FloatingTextField-PhoneFormatter

Repository files navigation

FloatingTextField-PhoneFormatter

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.

Installation

Copy /FloatingTextField+PhoneFormatter/Library folder to your project.

And import JVFloatLabeledTextField.h in your Controller.

Usage

Interface Builder:

  • Add UITextField on your UIViewController
  • Change UITextField class to JVFloatLabeledTextField
  • Customize your field:

Interface builder inspector

Programatically:

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

Example

Through the Demo project you can find out how it works, and tune it as you wish:

Example

Requirements

ARC Enabled. iOS 7+

About

Textfield with floating placeholder + phone formatter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published