stackoverflow.com/questions/24171857/implementing-uitextfielddelegate-with-swift
Implementing UITextFieldDelegate with Swift
I have my ViewController class which implements UITextFieldDelegate. I have no auto complete for the funcs such as textFieldShouldBeginEditing. Is this a bug in XCode 6? Here's my class implemen...
stackoverflow.com
UITextFieldDelegate ..
func textFieldDidBeginEditing(_textField: UITextField) {
TextField가 편집을 시작
}
func textFieldDidEditing(_textField: UITextField) {
TextField에서 편집을 종료
}
func textFieldShowBeginEdit(_textField: UITextField) -> Bool {
텍스트 필드 편집 방법 호출 시작
}
func textFieldShouldClear(_textField: UITextField) -> Boole {
TextField는 호출된 메서드를 지워야 함
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
문자를 입력하는 동안 이 메서드가 호출됨
}
func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
print("textFieldShouldEndEditing")
if textField.text != ""{
return true
}
else{
textField.placeholder = "도시를 입력해주세요"
return false
}
}//입력이 끝낫는데 텍스트필드 값이 ""이라면 false -> false이면 키보드가 내려가지않고 편집이 종료되지 않음
'개발 > 아이오에스' 카테고리의 다른 글
swift ] 다음 화면으로 데이터 전달하기 (0) | 2020.12.26 |
---|---|
swift 네비게이션바 배경색상 제목색상 변경 navigationController (0) | 2020.12.26 |
swift] 싱글톤패턴 적용하는법 해보기 (0) | 2020.12.23 |
swift] button 비활성화 하는 법 UIButton (0) | 2020.12.23 |
swift] 텍스트필드, 이미지뷰, 레이블 값 채워져있는지 확인하기 isEmpty (0) | 2020.12.23 |