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

[MDCTextInputControllerOutlined] Floating Placeholder text of input textfield border Radius causes UI issue

Open vinayak-nickelfox opened this issue 3 years ago • 8 comments

IMG_0803

I want my Textfield border radius half to my textfield's height. To achieving this is set borderRadius accordingly. But it results a parallel line created across my floating text. Kindly help me to fix this. or suggest a solution where can i shift my floating text position.

OS - iOS 13 Xcode - 11.3.1

vinayak-nickelfox avatar Sep 23 '20 12:09 vinayak-nickelfox

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

Hi @vinayak-nickelfox, I encourage you to switch to our newer text field offering, specifically the MDCOutlinedTextField. To use it add TextControls+OutlinedTextFields and/or TextControls+OutlinedTextFieldsTheming to your Podfile, and then #import "MaterialTextControls+OutlinedTextFields.h". See these docs for more info. Note that if you set a sufficiently large radius you will also have to set these properties.

andrewoverton avatar Sep 23 '20 16:09 andrewoverton

@andrewoverton, I Used the MDCOutlinedTextField to fulfil my requirements. But I could not able to customise the few things like setting fonts, font size, error states, error colour, placeholder colour and error state. Can you help me out with these problems

vinayak-nickelfox avatar Sep 24 '20 08:09 vinayak-nickelfox

Sure. Initialize a UIFont object with the pointSize you want and then set the font property inherited from UITextField. Placeholder color is currently not configurable. Floating label color is though--configure it using the color accessors on MDCOutlinedTextField's superclass, MDCBaseTextField. There isn't an error state per se. You have to call the error theming method in MaterialTextControls+OutlinedTextFieldsTheming.h to get to the error state, or implement your own error theming method that calls the relevant color accessors. Hope this helps!

andrewoverton avatar Sep 24 '20 15:09 andrewoverton

@andrewoverton I need to switch between colour schemes and typology schemes. but once I setup error scheme and now i have to switch to normal colour scheme, it reset to system fonts and default violet colour. Kindly help to setup color and typology scheme of my choice.

vinayak-nickelfox avatar Sep 29 '20 06:09 vinayak-nickelfox

We do not publicly expose theming methods that apply colors only :/ We only provide theming methods that accept container schemes and apply theming for all subsystems. As a workaround for your situation, I would suggest wrting your own supplementary theming methods, to be called after the Material theming methods. These would effectively undo the unwanted typography changes, for example, that the theming extension makes.

andrewoverton avatar Sep 29 '20 21:09 andrewoverton

IMG_0855

@andrewoverton I'm having a problem while giving background colour to the MDCOutlinedTextField textField. Now due to edge padding the background colour overflown the textfield borders.

vinayak-nickelfox avatar Oct 09 '20 11:10 vinayak-nickelfox

Hi @vinayak-nickelfox, we intentionally did not implement a way to set the backgroundColor of the area inside the outline, because the outline has a break in it for the floating label.

andrewoverton avatar Oct 09 '20 16:10 andrewoverton