Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ViewController.swift
- // Controlling the Keyboard
- //
- // Created by Anselmo Jorge on 18/03/17.
- // Copyright © 2017 Anselmo Jorge. All rights reserved.
- //
- import UIKit
- class ViewController: UIViewController, UITextFieldDelegate {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
- self.view.endEditing(true)
- //: guarda o teclado pois o usuaria tocar na tela
- }
- func textFieldShouldReturn(_ textField: UITextField) -> Bool {
- textField.resignFirstResponder()
- return true
- /* guarda o teclado pois o usuaria tocar na tecla retorno (Return) no teclado,
- para esta func. funcionar e preciso que a textField seja ligada ao view controller e
- escolher a opcao delegar. */
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement