override func viewDidLoad() {
super.viewDidLoad()
let textField = UITextField(frame: CGRect(x: 20.0, y: 60.0, width: 200.0, height: 30.0))
textField.borderStyle = UITextField.BorderStyle.roundedRect
textField.placeholder = "请输入...."
textField.adjustsFontSizeToFitWidth = true
textField.minimumFontSize = 10.0
self.view.addSubview(textField)
textField.returnKeyType = .join
textField.delegate = self
textField.clearButtonMode = .whileEditing
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
NSLog("textField - %@", textField.text!)
NSLog("textFieldShouldReturn")
return true
}
网友评论