【问题标题】:Why isn't UIKeyboard appearing when I tap inside a UITextField in swift?当我在 UITextField 中快速点击时,为什么 UIKeyboard 不出现?
【发布时间】:2014-09-04 13:23:22
【问题描述】:

这和swift有关吗?

我已经设置了一个与另一个没有任何连接的控制器,但它是使用它的故事板 ID 实例化的。

关联的类文件:

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) {
    }

}

这就是我展示注册控制器的方式:

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

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

我点击任何文本字段并获得闪烁的光标但没有出现键盘。

我错过了什么?

在 swift 之前,我可以添加文本字段,运行模拟器,然后键盘就会弹出。

我确信我做的一切都是正确的。

【问题讨论】:

    标签: cocoa-touch swift uitextfield uikeyboard uitextfielddelegate


    【解决方案1】:

    检查这些设置。转到 iOS 模拟器 -> 硬件 -> 键盘->切换软件键盘 还有

    iOS模拟器->硬件->键盘->取消选中Connect Hardware Keyboard

    【讨论】:

      猜你喜欢
      • 2014-06-14
      • 2019-02-14
      • 2021-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-26
      • 1970-01-01
      相关资源
      最近更新 更多