MFAFloatLabel
Installation
MFAFloatLabel is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MFAFloatLabel'Usage
The UI component can be used via the MFAFloatLabel or MFATextViewFloatLabel classes. This control can be used very similar to UITextField or UITextView - both from Interface Builder, or from code.
Font
You can change placeholder font name to be different from the text of your textField. Also change the font size of placeholder when typing.
textField.placeholderCustomFontName = "Menlo"
textField.placeholderEditingFontSize = 10Bottom border
textField.addBorder = true
textField.borderHeight = 1
textField.borderColor = .grayPlaceholder
textField.placeholderColor = .gray
textField.topSpacingFromPlaceholder = 6 // set the spacing bettwing text and placeholder when typingPadding
textField.leftSpacing = 8 // left padding bettwing text/placeholder and left margin
textField.rightSpacing = 8 // right padding bettwing text/placeholder and right marginIcon
textField.icon = #imageLiteral(resourceName: "icon")
textField.iconAtTrailing = true // set it false if you want icon on right
textField.iconSpacing = 8 // spacing bettwing icon and margin
textField.iconWidth = 12
textField.iconHeight = 12Others
textField.onlyNumbers = false // set it true if your textField will accept only numbersFormatting
We also provide custom format. Just set the mask and the character to be replaced
textField.setFormatting("(__) _____.____", replacementChar: "_")And you can set it as secure text
textField.formatedSecureTextEntry = falseAuthor
matheusfrozzi, [email protected]
License
MFAFloatLabel is available under the MIT license. See the LICENSE file for more info.
