I am working on iPhone application and I have multiple UITextFields for input.
the problem with small devices only like iPhone 5 , 6. when The keyboard appears , the bottom textFields hide. it is working fine with big iPhone screen like XR , XS Max
how can I add condition that check if the bottom textfields Hidden or not ?
guard let keyboardReact = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else {
return
}
let screen = view.frame.size.height - keyboardReact.height
let safeAreHeight = self.view.frame.height - self.topLayoutGuide.length - self.bottomLayoutGuide.length
if safeAreHeight + keyboardReact.height > view.frame.size.height {
if currentTappedTextField == phoneTextField || currentTappedTextField == employeeEmailTextField || currentTappedTextField == relationTextField {
if notification.name == UIResponder.keyboardWillShowNotification || notification.name == UIResponder.keyboardWillChangeFrameNotification{
view.frame.origin.y = -(keyboardReact.height)
} else {
view.frame.origin.y = 0
}
}
}
This is work with all screen sizes I want it work only when the keyboard hide the textFields