项目作者: lemonade-hq

项目描述 :
Customisable iOS TextField with floating placeholder
高级语言: Swift
项目地址: git://github.com/lemonade-hq/LMDFloatingLabelTextField.git
创建时间: 2018-01-09T09:23:38Z
项目社区:https://github.com/lemonade-hq/LMDFloatingLabelTextField

开源协议:MIT License

下载


LMDFloatingLabelTextField

CI Status
Version
License
Platform

Demo

alt text

Demo #2

alt text

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

Cocoapods

Install Cocoapods

  1. $ gem install cocoapods

Add LMDFloatingLabelTextField in your Podfile.

  1. use_frameworks!
  2. pod 'LMDFloatingLabelTextField'

Install the pod

  1. $ pod install

Manually

Copy LMDFloatingLabelTextField folder to your project. Enjoy.

Usage

Interface Builder

  • Drag a UITextField to you view, and change its class to LMDFloatingLabelTextField
    alt text

  • Click Attributes Inspector alt text
    and notice the new Progress Bar section on top

alt text

Code

  • Create a new LMDFloatingLabelTextField
    1. let textfield = LMDFloatingLabelTextField(frame: CGRect(x: 0,
    2. y: 0,
    3. width: 200,
    4. height: 48))
  • Set the values as you like

    1. textfield.placeholderText = "Email"
    2. textfield.borderColor = .yellow
    3. textfield.errorBorderColor = .cyan
    4. textfield.themeColor = .red
    • Add LMDFloatingLabelTextField to the view
      1. self.view.addSubview(textfield)

That’s it!

Customizable Properties

placeholderText - Please make sure you put something here. it will look awful without it.

placeholderFont - Default is system(14).

placeholderSizeFactor - While editing, placeholder will shrink according to this number. deafult is 0.7.

placeholderTextColor - Default is - #B7B7B7 #B7B7B7

themeColor - Replaces tintColor. Carret color. default is #FF0083 #FF0083

borderColor - Border color while editing. default is #4a4a4a #4a4a4a

errorBorderColor - Border color on error. default is #FF0083 #FF0083

textFieldTextColor - Replaces textColor. default is #4A4A4A #4A4A4A

disabledTextColor - TextColor when textfield is disabled. default is #B7B7B7 #B7B7B7

disabledBackgroundColor - Background color when textfield is disabled. default is #f7f7f7 #f7f7f7

enabledBackgroundColor - Background color when textfield is not disabled. default is #FFFFFF #FFFFFF

error - Will change border color to errorBorderColor regardless of whether the textField is focused or not.

Author

Tal Cohen, talthent@gmail.com

LEMONADE INC.

License

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