I trying to show a keyboard when pressing on UILabel using NotificationCenter but the keyboard function is not calling and not showing the keyboard, I really need to show a keyboard appear when pressing on UILabel in Swift.
inside my class
MyClass : UIControl {}
but the keyboard function is not calling
private func _ini(){ let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(KeyboardDidShow(_:)), name: UIResponder.keyboardDidShowNotification, object: nil) }
func KeyboardDidShow( myNotification: NSNotification){
print("keyBoardUp")
}
Keyboard only shows up for views which accept inputs eg UITextField
, UITextview
etc or the views which confirm to follow UIKeyInput
protocol and implement canBecomeFirstResponder
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.