Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlaceHolder not shown #44

Closed
tjsingh04 opened this issue May 8, 2019 · 13 comments
Closed

PlaceHolder not shown #44

tjsingh04 opened this issue May 8, 2019 · 13 comments
Labels

Comments

@tjsingh04
Copy link

General Information

What happened?

Placeholder is not shown even if set it programatically or from storyboard

What did you expect to happen?

Placeholder should shown in text feild

@NikKovIos
Copy link
Owner

@tjsingh04 Did you check the example project?

@tjsingh04
Copy link
Author

yes i was checked , i think the problem is pre fill text of country code in the textfield, when i remove country code then it show the placeholder but i need it even if country code is there.

@NikKovIos
Copy link
Owner

Place your code or project here.

@tjsingh04
Copy link
Author

tjsingh04 commented May 9, 2019

set NKVPhonePickerTextField directly from storyboard and create its outlet shown as below

@IBOutlet weak var phoneTF: NKVPhonePickerTextField!

and in viewDidLoad is have use below code

    phoneTF.phonePickerDelegate = self
    phoneTF.placeholder = "Phone Number"
    phoneTF.flagInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0)
    phoneTF.layer.cornerRadius = 10

@tjsingh04
Copy link
Author

tjsingh04 commented May 9, 2019

you can also check in your sample project as well. placeholder only shows when remove country code from it. but i need it with country code if you can help.
here are the screenshoots

Simulator Screen Shot - iPhone Xʀ - 2019-05-09 at 12 30 54
Simulator Screen Shot - iPhone Xʀ - 2019-05-09 at 12 31 01

@NikKovIos
Copy link
Owner

Hmm, the plus is too close to flag also. What phone model is it?
Fix your message markdown pls.

@tjsingh04
Copy link
Author

tjsingh04 commented May 9, 2019

plus is closed, becoz of flagInsets i think and phone model is iphone XR 12.2 version

@NikKovIos
Copy link
Owner

NikKovIos commented May 14, 2019

Sorry, but the textField is using a standard placeholder and i don't see how to easily change its behaviour.

However you can set a little hack like:

textField.countryPickerDelegate = self

extension ViewController: CountriesViewControllerDelegate {
    func countriesViewController(_ sender: CountriesViewController, didSelectCountry country: Country) {
        print("✳️ Did select country: \(country)")
        textField.placeholder = country.phoneExtension
    }
}

Also tell what you exactly want to achieve?

@tjsingh04
Copy link
Author

tjsingh04 commented May 14, 2019

i just want to show place holder just like my second screenshoot, but it only show when i remove whole text from textfield i.e when remove country code, means place holder is not shown with country code added in textfield as you see in first screenshoot , it shows when i remove country code (refer to 2nd screenshoot).

i want to show place holder with country code added in textfield. now do you get my point?

@NikKovIos
Copy link
Owner

NikKovIos commented May 14, 2019 via email

@tjsingh04
Copy link
Author

yes i think so, is there any other hack for it

@NikKovIos
Copy link
Owner

NikKovIos commented May 14, 2019 via email

@tjsingh04
Copy link
Author

okay Thanks Brother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants