material-components-ios
material-components-ios copied to clipboard
[MDCTextInputControllerOutlined] Floating Placeholder text of input textfield border Radius causes UI issue
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
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, 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
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 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.
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 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.
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.