Latest 0.1.0
Homepage https://github.com/Phyber64/AHTextField
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Screenshots

img
img
img

Example

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

Requirements

iOS 9.0+

Usage

Exampple of AHTextField

lazy var textField: AHTextField = {
    let textField = AHTextField(textPadding: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 15))
    textField.translatesAutoresizingMaskIntoConstraints = false
    textField.setLeftViewImage(image: UIImage(named: "lock"), size: CGSize(width: 25, height: 25), tintColor: .gray)
    textField.setRightViewImage(image: UIImage(named: "cancel"), size: CGSize(width: 30, height: 30), tintColor: appleRed)
    textField.leftViewPadding.left = 8
    textField.setBorders(width: 2, color: .blue)
    textField.placeholder = "Password"
    return textField
}()

Initialization with default text padding

let textField = AHTextField(textPadding: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15))

Adding images

textField.setLeftViewImage(image: image1, size: CGSize(width: 25, height: 25), tintColor: .gray)
textField.setRightViewImage(image: image2, size: CGSize(width: 30, height: 30), tintColor: .red, backgroundColor: .blue)

Setting borders

textField.setBorders(for: [.bottom], width: 3, gradient: gradientLayer)

Note: gradientLayer is copied => you can use one gradintLayer as a parameter for multiple textFields

or

textField.setBorders(width: 2, color: appleBlue)

Padding

You can change the padding if default values don’t fit

textField.leftViewPadding.left = 8
textField.clearButtonPadding.right = 15
textField.rightViewPadding.right = 10

Installation

AHTextField is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'AHTextField'

Author

Aleš Hanžlík, [email protected]

License

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

Latest podspec

{
    "name": "AHTextField",
    "version": "0.1.0",
    "summary": "AHTextField makes work with TextFields easier, including: Images, gradients, textPadding etc.",
    "swift_version": "4.2",
    "description": "AHTextField lets you easily work with images, one-side borders, gradients, text padding etc. inside TextFields. AHTextField inherits from UITextField and adds some other functionality on top.",
    "homepage": "https://github.com/Phyber64/AHTextField",
    "screenshots": [
        "https://imgur.com/Rq3cXaG.png",
        "https://imgur.com/Oxy32J7.png",
        "https://imgur.com/uu17SR8.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Aleu0161 Hanu017elu00edk": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Phyber64/AHTextField.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "AHTextField/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This