LineTextField
Custom UITextField with floated placeholder and an underline.
Requirenments
- iOS 9.0+
Installation
CocoaPods
LineTextField is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'LineTextField', '~> 1.0'
Usage
import LineTextField
//Connect IBOutlet
@IBOutlet var lineTextField: LineTextField!
//Create programmatically
let lineTextField = LineTextField(frame: CGRect(x: 20, y: 400, width: view.frame.width - 40, height: 35))
lineTextField.floatingPlaceholder = true
Bottom line
You can specify default and active color for bottom line for LineTextField
.
lineTextField.lineColorDefault = UIColor.red
lineTextField.lineColorActive = UIColor.blue
These properties are available for change in Interface Builder.
Floating placeholder
You can use floating placeholder
lineTextField.floatingPlaceholder = true
and specify text color for active/inactive state of floating placeholder
lineTextField.floatingPlaceholderColor = UIColor.red
lineTextField.floatingPlaceholderActiveColor = UIColor.blue
These properties are available for change in Interface Builder.
Demo
You can see other features in the example project.