Cocoa touch 为什么不是';当我在swift中点击UITextField内部时,UIKeyboard是否出现?
这和斯威夫特有关吗 我已经设置了一个控制器,没有任何与另一个控制器的连接,但它是使用它的故事板ID实例化的 关联类文件:Cocoa touch 为什么不是';当我在swift中点击UITextField内部时,UIKeyboard是否出现?,cocoa-touch,swift,uitextfield,uikeyboard,uitextfielddelegate,Cocoa Touch,Swift,Uitextfield,Uikeyboard,Uitextfielddelegate,这和斯威夫特有关吗 我已经设置了一个控制器,没有任何与另一个控制器的连接,但它是使用它的故事板ID实例化的 关联类文件: import Foundation import UIKit class SignUpViewController : UIViewController, UITextFieldDelegate { @IBOutlet weak var companyField: UITextField! @IBOutlet weak var emailField: UIT
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)
}
这是我演示注册控制器的方式:
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之前,我只需添加文本字段,运行模拟器,键盘就会弹出
我确信我做的每件事都是正确的 检查这些设置。转到 iOS模拟器->硬件->键盘->切换软件键盘 也 iOS模拟器->硬件->键盘->取消选中
连接硬件键盘