UITextField and NSFormatter subclasses for formatting phone numbers. Allow different formats for different countries(patterns). Caret positioning works excellent.
pod 'SHSPhoneComponent' or copy /SHSPhoneComponent folder to your project.
##Example Usage If you need complete example please see /example folder.
###Default Format
[self.phoneField.formatter setDefaultOutputPattern:@"+# (###) ###-##-##"];Also you can preset first part of number with format. For example, if you want numbers only from Russia, use next code:
[self.phoneField.formatter setDefaultOutputPattern:@"+7 (###) ###-##-##"];
self.phoneField.formatter.showFormatOnlyIfTextExist = NO;
[self.phoneField setFormattedText:@""];###Specific Formats If you want to format some numbers in specific way just do
[self.phoneField.formatter addOutputPattern:@"+# (###) ###-##-##" forRegExp:@"^7[0-689]\\d*$" imagePath:@"flagRU"];
[self.phoneField.formatter addOutputPattern:@"+### (##) ###-###" forRegExp:@"^374\\d*$" imagePath:@"flagAM"];##Formatting If you need only formatting function you can use SHSPhoneNumberFormatter class. For additional class info see http://serheo.github.io/SHSPhoneComponent/
##Requirements ARC Enabled. Tested under iOS >= 5.0. iOS 7 beta support.
##License SHSPhoneComponent is available under the MIT license. See the LICENSE file for more info.



