MDCTextInputController 错误消息覆盖输入的文本

MDCTextInputController error messages cover entered text

使用 material-components/material-components-ios v85.8.0

import MaterialComponents

....

var usernameTextField = MDCTextField()
var userNameTextLayout = MDCTextInputControllerUnderline()
usernameTextField = {
    let usernameTextEdit = MDCTextField()
    usernameTextEdit.translatesAutoresizingMaskIntoConstraints = false
    usernameTextEdit.clearButtonMode = .unlessEditing
    usernameTextEdit.backgroundColor = .white
    return usernameTextEdit
}()
userNameTextLayout.textInput = usernameTextField
userNameTextLayout.placeholderText = "Username"
// add to view
....

private func isUserNameValid() -> Bool {
    let enteredUsername = usernameTextField.text ?? ""
    if (!enteredUsername.isValidEmail) {
        userNameTextLayout.setErrorText("Invalid e-mail address",
                                        errorAccessibilityValue: nil)
        return false
    }
}

错误消息覆盖了输入的文本,看起来很糟糕:

Android material design 确实将错误置于该行下方:

想知道是否有办法做到这一点,或者我是否做错了。

我遵循了他们的教程:https://codelabs.developers.google.com/codelabs/mdc-101-swift/#2

我将 MDCTextField 的高度设置得太小了。在将它从 50->80pts 增加时,它达到了目的,并将错误消息移到该行下方。