相关疑难解决方法(0)

键盘上的NSNotificationCenter Swift 3.0显示和隐藏

我试图在键盘显示和消失时运行一个函数,并具有以下代码:

let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(ViewController.keyBoardUp(Notification :)), name:  NSNotification.Name.UIKeyboardWillShow, object: nil)
Run Code Online (Sandbox Code Playgroud)

以下功能keyBoardUp:

func keyBoardUp( Notification: NSNotification){
    print("HELLO")
}
Run Code Online (Sandbox Code Playgroud)

但是,当键盘显示时,该功能不会打印到控制台.非常感谢帮助

keyboard-events nsnotificationcenter ios swift

15
推荐指数
4
解决办法
3万
查看次数