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

Change Placeholder to attributed font #195

Closed
rp9994 opened this issue Nov 26, 2019 · 9 comments
Closed

Change Placeholder to attributed font #195

rp9994 opened this issue Nov 26, 2019 · 9 comments
Labels

Comments

@rp9994
Copy link

rp9994 commented Nov 26, 2019

I unable to change the attributed font. how can I can change the same

@raulriera
Copy link
Owner

Hi, please provide more detailed description of what you are trying to do

@rp9994
Copy link
Author

rp9994 commented Nov 27, 2019

i want to create like this

Screenshot 2019-11-27 at 3 13 54 PM

@raulriera
Copy link
Owner

For that you will have to modify the code, there is option to supply an attributed text for the placeholder

@julien-tamade
Copy link

Hi, I'm also having trouble adjusting the placeholder text. You say there is an option, but when I try to I get the error CoreText note: Client requested name ".SFUI-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:]. I am trying to make my sign in form compatible with dark mode. Thank You.

@raulriera
Copy link
Owner

The error message is properly telling you what is going on, have you tried fixing the font first?

@julien-tamade
Copy link

Yeah I'm trying emailInput.attributedPlaceholder = NSAttributedString(string: "Test Email", attributes: [NSAttributedString.Key.foregroundColor: UIColor.red, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 40)]) where emailInput is a HoshiTextField, but neither the color nor size attributes are affecting the placeholder text

@raulriera
Copy link
Owner

Ah I see, emailInput.attributedPlaceholder is a property of UITextField directly and bypassing the values in this library. You need to use

placeholderFontScale to change the size
placeholderColor to change the color

This library doesn't support changing the font via attributed text, is its a combination of those 2 properties mentioned and using the normal font property

@julien-tamade
Copy link

ah thank you!

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 3 days if no further activity occurs.

@stale stale bot added the stale label Jan 8, 2020
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

3 participants