Created
January 24, 2017 11:32
-
-
Save fozoglu/ecb99d82c76d0d381c2ae3f8d51ebc7a to your computer and use it in GitHub Desktop.
Custom TextField
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@IBDesignable class DesignableTextField: UITextField { | |
@IBInspectable var borderWidth: CGFloat = 0.0{ | |
didSet{ | |
self.layer.borderWidth = borderWidth | |
} | |
} | |
@IBInspectable var borderColor: UIColor = UIColor.clear{ | |
didSet{ | |
self.layer.borderColor = borderColor.cgColor | |
} | |
} | |
@IBInspectable var cornerRadius: CGFloat = 0 { | |
didSet{ | |
self.layer.cornerRadius = cornerRadius | |
} | |
} | |
@IBInspectable var placeHolderColor: UIColor = UIColor.clear{ | |
didSet{ | |
if let placeholder = self.placeholder { | |
let attributes = [NSForegroundColorAttributeName: placeHolderColor] | |
attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment