CosmicMind/Material

Is there any way to achieve this with ErrorTextField

silnose opened this issue · 3 comments

Use placeholderLabel with one text on the top
Use placeholder inside the textField with different text.

image

Thank in advance! ;)

@silnose Hey! There isn't out of the box. You can subclass the ErrorTextField class and then add the UILabel and show it when the component is active/focus. Let me know how it goes, and I would be happy to help further if you show me an initial approach. I will close for now.

Thk for the early response @DanielDahan !.

I can do the thick following this steps:

  1. Set attribute 'isPlaceholderAnimated' to false:
    textField.isPlaceholderAnimated = false
  2. Set property attributedPlaceholder
 textField.attributedPlaceholder = NSAttributedString(string:"my real placeholder",
                                                   attributes: [NSAttributedString.Key.foregroundColor: UIColor(named: "cloudy_blue"

and magic happens!. The first one is acting like a label and the second one as a placeholder.

Nicely done! And no added elements :)