我无法让键盘在我的SignUpViewController上显示和隐藏。
//Keyboard frame size
var keyboard = CGRect()
//Default function
override func viewDidLoad() {
super.viewDidLoad()
//scrollView frame size
self.scrollView.frame = CGRect(x: 0, y: 0, width: self.scrollView.frame.size.width, height: self.scrollView.frame.size.height)
scrollView.contentSize.height = self.view.frame.height
scrollViewHeight = scrollView.frame.size.height
//check notificvations if keyboard is shown or not
let notificationCenter = NotificationCenter.default
NotificationCenter.default.addObserver(self, selector: #selector(SignUpVC.keyboardWillShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(SignUpVC.keyboardWillHide), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
}
答案 0 :(得分:0)
你必须设置一个uitextfield作为第一个响应者。