Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

UITextField Placeholder #95

Open
tobinharris opened this issue Apr 18, 2015 · 2 comments
Open

UITextField Placeholder #95

tobinharris opened this issue Apr 18, 2015 · 2 comments
Labels

Comments

@tobinharris
Copy link

Anyone got an example of styling a UITextField with custom colours for placeholder and input text.

image

Is achieved by this, but after editing the green text style reverts to that of the placeholder.

MyView {
  ^UILabel{
    font: $default-font 18
    text-color: #222222
  }
  UITextField{
    font: $default-font 20
    text-color: #67AB1C

    UIFieldEditor{
        UITexiFieldLabel{
        text-color: #CCCCCC
    }
      }
      UILabel{
        text-color: #67AB1C
      }

  }
} 
@keithnorm
Copy link
Contributor

The main problem is that UIKit doesn't expose a color property for the placeholder text (see http://stackoverflow.com/questions/1340224/iphone-uitextfield-change-placeholder-text-color). You can however set an attributed string through textField.attributedPlaceholder and set the foregroundColor of that attributed string from a property that is set via Classy.

Let me know if that doesn't make sense and I can work up a quick example.

@dnedrow
Copy link
Member

dnedrow commented Oct 9, 2017

@keithnorm , I don't know if you're still monitoring Classy, but could you provide the example you mentioned for using attributedPlaceholder? I've been trying to work this out and haven't found the magic combination yet.

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

No branches or pull requests

3 participants