@IBOutlet var userPhoneNumber: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// touch (start editing)
userPhoneNumber.addTarget(self, action: #selector(self.myTouchEvent), for: UIControlEvents.editingDidBegin)
// end editing
userPhoneNumber.addTarget(self, action: #selector(self.myEndTouchEvent), for: UIControlEvents.editingDidEnd)
}
func myTouchEvent(textfield: UITextField) {
print("textfield touched")
}
func myEndTouchEvent(textfield: UITextField) {
print("textfield edit end")
}
'iOS Swift' 카테고리의 다른 글
swift3 save image to UserDefaults (0) | 2017.01.02 |
---|---|
resign keyboard textfield (0) | 2016.12.31 |
Swift3 UITextField border bottom (0) | 2016.12.31 |
swift3 : change button background color 버튼 배경색 변경하기 hex to UIColor (0) | 2016.12.13 |
swift3 textFieldDidChange 텍스트필드 이벤트 감지 (0) | 2016.12.13 |