// Prepare variables
varisShown=false
// Configure monitoring in viewDidLoad, etc.
NotificationCenter.default.addObserver(self,selector:#selector(keyboardDidAppear), name:UIResponder.keyboardDidShowNotification, object:nil)
NotificationCenter.default.addObserver(self,selector:#selector(keyboardDidDisappear), name:UIResponder.keyboardDidHideNotification, object:nil)
switch flags
@objc func keyboardDidAppear(){
isShown = true
}
@objc func keyboardDidDisappear(){
isShown = false
}
if isShown{
// When the keyboard is displayed
} else{
// the time when a person is hiding
}
© 2024 OneMinuteCode. All rights reserved.