Мне интересно, как убрать клавиатуру, если пользователь прикасается за пределами UITextField
. Я использую Xcode 6.1. Я добавил UITextField
в UIViewController
в соответствии с нижеследующей функцией ViewDidLoad()
. Любая помощь по увольнению ключевого совета была бы высоко оценена.в быстром, как убрать клавиатуру
class PickerdemoViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate{
var textBox1 : UITextField!
override func viewDidLoad() {
//..................adding text box.........................//
self.textBox1 = UITextField (frame: CGRectMake(100, 152.5, 50, 35))
textBox1.delegate = self
textBox1.backgroundColor = UIColor.whiteColor()
textBox1.placeholder = "enter"
textBox1.keyboardType = UIKeyboardType.DecimalPad
self.textBox1.resignFirstResponder()
textBox1.keyboardAppearance = UIKeyboardAppearance.Default
self.view.addSubview(textBox1)
super.viewDidLoad()
}
возможно дубликат [resignFirstResponder в Swift] (http://stackoverflow.com/questions/24034786/resignfirstresponder-in-swift) –