Latest 1.0.0
Homepage https://github.com/matheusfrozzi/MFAFloatLabel
License MIT
Platforms ios 9.3
Frameworks UIKit
Authors

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.

Delegate

To use with UITextFieldDelegate methods you should implement MFAFloatLabelDelegate and set it on your MFAFloatLabel.

textField.floatLabelDelegate = self

Font

You can customize the placeholder of your textField by changing the font name and size.

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.

Latest podspec

{
    "name": "MFAFloatLabel",
    "version": "1.0.0",
    "summary": "A beautiful and flexible UITextField subclass with material design style.",
    "platforms": {
        "ios": "9.3"
    },
    "swift_versions": "5.0",
    "frameworks": "UIKit",
    "homepage": "https://github.com/matheusfrozzi/MFAFloatLabel",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "matheusfrozzi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/matheusfrozzi/MFAFloatLabel.git",
        "tag": "1.0.0"
    },
    "source_files": "MFAFloatLabel/Classes/**/*",
    "swift_version": "5.0"
}

Pin It on Pinterest

Share This