material-components-ios icon indicating copy to clipboard operation
material-components-ios copied to clipboard

MDCTextInputControllerFilled - Placeholder text is missing and cursor is placed beyond textfield's width

Open sonalikal opened this issue 5 years ago • 6 comments

I am using MDCTextInputControllerFilled.

The placeholder text is missing for the textfield's : textField.placeholderText = "Text"

Also the cursor falls way outside the bounds of the textfield: Screenshot 2020-06-11 at 1 04 34 PM

  • OS: iOS 13
  • Xcode 11

This works perfectly well on Xcode 10.2. This issue shows up only when using Xcode 11

sonalikal avatar Jun 11 '20 11:06 sonalikal

The title doesn't have a [Component] prefix.

Hello @sonalikal, the attached image looks like an underlined text field. Have you tried using the newer and better-supported MDCUnderlinedTextField to accomplish this? The bug you are describing does not exist in MDCUnderlinedTextField.

andrewoverton avatar Jun 15 '20 16:06 andrewoverton

Hello @sonalikal, the attached image looks like an underlined text field. Have you tried using the newer and better-supported MDCUnderlinedTextField to accomplish this? The bug you are describing does not exist in MDCUnderlinedTextField.

Hi @andrewoverton. I tried looking up in the documentation about the TextField you mentioned, does it lie under the 'MaterialComponents/TextFields' pod because I'm unable to locate it. Maybe I'm looking in the wrong direction. Would appreciate your help.

sonalikal avatar Jul 06 '20 09:07 sonalikal

Hi @sonalikal, sorry, it's a bit confusing. To use MDCUnderlinedTextField add TextControls+UnderlinedTextFields and/or TextControls+UnderlinedTextFieldsTheming to your Podfile. The TextFields component has our legacy text field implementation.

andrewoverton avatar Jul 06 '20 13:07 andrewoverton

Hi @sonalikal, sorry, it's a bit confusing. To use MDCUnderlinedTextField add TextControls+UnderlinedTextFields and/or TextControls+UnderlinedTextFieldsTheming to your Podfile. The TextFields component has our legacy text field implementation.

Thanks for the clarification @andrewoverton. Is the floating placeholder property still applicable for this textfield. Sorry for the basic questions but I'm finding it a bit hard to transition from MDCTextInputControllerFilled to MDCUnderlinedTextField. Appreciate the help :)

sonalikal avatar Jul 22 '20 15:07 sonalikal

Hello @sonalikal,

The new text fields differentiate between the floating label and the placeholder. Where you would've previously done something like this, if I remember correctly:

textInputController.textInput.placeholder = @"floating label text";

Now do this:

underlinedTextField.label.text = @"floating label text";

You can still set the placeholder on the new ones, but it'll be more like setting placeholder on a UITextField.

Let me know if you have any other questions!

andrewoverton avatar Jul 24 '20 19:07 andrewoverton