FahimF / FloatLabelFields

Text entry controls which contain a built-in title/label so that you don't have to add a separate title for each field.
MIT License
1.19k stars 107 forks source link

placeHolder color #11

Open hugocarlmartin opened 9 years ago

hugocarlmartin commented 9 years ago

Hi, everything works like a charm. Except that I cant change my placeholder text as I usually do.

override var placeholder: String? {
    willSet(value) {
        super.attributedPlaceholder = NSAttributedString(string: value!, attributes: [NSForegroundColorAttributeName : UIColor.whiteColor(), NSFontAttributeName : self.font])
    }
}

Any ideas?

Lawgrin commented 9 years ago

@hugocarlmartin This seems to work. then you can set it in the story board

@IBInspectable var placeholderTextColour:UIColor = UIColor.grayColor() {
        didSet{
            if placeholder != nil
            {
                self.attributedPlaceholder = NSAttributedString(string: placeholder!, attributes: [NSForegroundColorAttributeName:placeholderTextColour])
            }
        }
    }