MFAFloatLabel 1.0.0

MFAFloatLabel 1.0.0

Maintained by Uriel Battanoli, Matheus Frozzi.



  • By
  • matheusfrozzi

MFAFloatLabel

Version License Platform

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 = 10

Bottom border

textField.addBorder = true
textField.borderHeight = 1
textField.borderColor = .gray

Placeholder

textField.placeholderColor = .gray
textField.topSpacingFromPlaceholder = 6 // set the spacing bettwing text and placeholder when typing

Padding

textField.leftSpacing = 8 // left padding bettwing text/placeholder and left margin
textField.rightSpacing = 8 // right padding bettwing text/placeholder and right margin

Icon

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 = 12

Others

textField.onlyNumbers = false // set it true if your textField will accept only numbers

Formatting

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 = false

Author

matheusfrozzi, [email protected]

License

MFAFloatLabel is available under the MIT license. See the LICENSE file for more info.