Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. //
  2. // ViewController.swift
  3. // Controlling the Keyboard
  4. //
  5. // Created by Anselmo Jorge on 18/03/17.
  6. // Copyright © 2017 Anselmo Jorge. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class ViewController: UIViewController, UITextFieldDelegate {
  12.  
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. // Do any additional setup after loading the view, typically from a nib.
  16. }
  17.  
  18. override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
  19.  
  20. self.view.endEditing(true)
  21.  
  22. //: guarda o teclado pois o usuaria tocar na tela
  23. }
  24.  
  25. func textFieldShouldReturn(_ textField: UITextField) -> Bool {
  26. textField.resignFirstResponder()
  27. return true
  28.  
  29. /* guarda o teclado pois o usuaria tocar na tecla retorno (Return) no teclado,
  30. para esta func. funcionar e preciso que a textField seja ligada ao view controller e
  31. escolher a opcao delegar. */
  32. }
  33.  
  34. override func didReceiveMemoryWarning() {
  35. super.didReceiveMemoryWarning()
  36. // Dispose of any resources that can be recreated.
  37. }
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement