Created
October 6, 2017 13:40
-
-
Save sharat/60861c51d6bb4b84e10d2f6827e72c7e to your computer and use it in GitHub Desktop.
This file contains 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
extension UITextField { | |
func useUnderline() -> Void { | |
let border = CALayer() | |
let borderWidth = CGFloat(2.0) // Border Width | |
border.borderColor = UIColor.red.cgColor | |
border.frame = CGRect(origin: CGPoint(x: 0,y :self.frame.size.height - borderWidth), size: CGSize(width: self.frame.size.width, height: self.frame.size.height)) | |
border.borderWidth = borderWidth | |
self.layer.addSublayer(border) | |
self.layer.masksToBounds = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment