@IBOutlet var userID: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
userID.underlined()
}
extension UITextField {
func underlined(){
let border = CALayer()
let width = CGFloat(1.0)
border.borderColor = UIColor.lightGray.cgColor
border.frame = CGRect(x: 0, y: self.frame.size.height - width, width: self.frame.size.width, height: self.frame.size.height)
border.borderWidth = width
self.layer.addSublayer(border)
self.layer.masksToBounds = true
}
}
'iOS Swift' 카테고리의 다른 글
swift3 add touch event to uitextfield editingDidBegin/editingDidEnd (0) | 2017.01.02 |
---|---|
swift3 save image to UserDefaults (0) | 2017.01.02 |
resign keyboard textfield (0) | 2016.12.31 |
swift3 : change button background color 버튼 배경색 변경하기 hex to UIColor (0) | 2016.12.13 |
swift3 textFieldDidChange 텍스트필드 이벤트 감지 (0) | 2016.12.13 |