Created
January 14, 2017 17:36
-
-
Save mikru1688/20ee6c06ffc1d06beec78cd682ab1579 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
// MARK: - Delegate | |
// --------------------------------------------------------------------- | |
// 關閉瑩幕小鍵盤 | |
func dismissKeyboard() { | |
self.view.endEditing(true) | |
} | |
// 當按下右下角的return鍵時觸發 | |
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | |
textField.resignFirstResponder() // 關閉鍵盤 | |
return true | |
} | |
// 設定欄位是否可以清除 | |
func textFieldShouldClear(_ textField: UITextField) -> Bool { | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment