Reputation:
I want to create a textfield with country code. User is not able to change counrty code so the code must be passive on textfield. Anyone has any idea?
Upvotes: 0
Views: 928
Reputation:
I solved my problem with UITextField's leftview. For your info,
UILabel *countryCodeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 15, theCell.textfield.frame.size.height)];
countryCodeLabel.text = @" 0090";
[countryCodeLabel sizeToFit];
theCell.textfield.leftView = countryCodeLabel;
theCell.textfield.leftViewMode = UITextFieldViewModeAlways;
Upvotes: 0
Reputation: 2446
You can use this Link from Github, which will provide you phone number textfield with a fancy country code picker.
And it provides you delegate methods when a country is selected, when the phone number is valid or not and you can get phone number in severals formats.
Upvotes: 1