RinnovamentoFIRSPESPONDER IN SWIFT.
Domanda
Come posso implementarlo nella nuova lingua di Apple:
Codice Obiettivo-C:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
for (UIView *view in self.view.subviews)
[view resignFirstResponder];
}
.
Ho provato a farlo.Ma la tastiera non scompare:
SWIFT Codice:
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
super.touchesBegan(touches, withEvent: event)
self.view.resignFirstResponder()
}
. Soluzione
Potresti probabilmente andare con:
self.view.endEditing(true)
. Altri suggerimenti
Prova questo
self.view.endEditing(true)
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow