ios,swift2020. 1. 30. 10:30

[ios]swift textfield 직접 입력하기

 

 

 func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

 if let text : String = (textField.text as NSString?)?.replacingCharacters(in: range, with: string) as String?

            {

print("text -> \(text)")

            }

 

return false

}

 

return false처리하고... replacingCharacters 등록 시키면 text를 구할 수 있다.. 직접 넣으면 된다.. 

Posted by thdeodls85