2

The placeholder is not floating above the textfield, any ideas?:

https://i.stack.imgur.com/DLLPC.jpg

@IBOutlet weak var text: MDCTextField!

override func viewDidLoad() {
    super.viewDidLoad()
    var textFieldController = MDCTextInputControllerUnderline(textInput: text)
    text.placeholder = "TEST"
}
Gabe Mann
  • 23
  • 3

1 Answers1

8

It seems as if you aren't retaining your underline controller. Make it a property (var or let outside a method.) That should keep it around so it can do the work instead of leaving the text field to revert to unstyled defaults.

Will Larche
  • 3,119
  • 7
  • 26
  • 34
  • 2
    Thanks Will! That was the problem. Here is the updated code: let textFieldController = MDCTextInputControllerUnderline() override func viewDidLoad() { super.viewDidLoad() textFieldController.textInput = text } – Gabe Mann Mar 12 '18 at 23:50