Search code examples
cocoa-touchswiftuitextfielduikeyboarduitextfielddelegate

Why isn't UIKeyboard appearing when I tap inside a UITextField in swift?


Is this something to do with swift?

I've set up a controller without any connection to another but it is instantiated using it's storyboard ID.

Associated class file:

import Foundation
import UIKit

class SignUpViewController : UIViewController, UITextFieldDelegate {
    @IBOutlet weak var companyField: UITextField!
    @IBOutlet weak var emailField: UITextField!
    @IBOutlet weak var passwordField: UITextField!


    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

    }


    @IBAction func loginButtonTapped(sender: UIButton) {

    }

    @IBAction func forgotPasswordButtonTapped(sender: UIButton) {
    }


    @IBAction func signUpButtonTapped(sender: UIButton) {
    }

}

This is how I present the sign up controller:

@IBAction func signUpButtonTapped(sender: UIButton) {
    let signUpViewController = self.storyboard?.instantiateViewControllerWithIdentifier("signUpViewControllerSB") as SignUpViewController

    self.presentViewController(signUpViewController, animated: true, completion: nil)
} 

I tap in any text field and get the flashing cursor but no keyboard appears.

What am I missing?

Prior to swift I could just add textfields, run simulator and the keyboard would pop up.

I'm sure I've done everything correctly.


Solution

  • Check these settings.Go to iOS Simulator -> Hardware -> Keyboard->Toggle Software Keyboard also

    iOS Simulator -> Hardware -> Keyboard-> Uncheck Connect Hardware Keyboard