When i tap on a textfield in a table view cell and keyboard appears the cell automatically scrolls up to make the text field visible. This happens perfectly in ios 10 but not in iOS 11. Does anyone have a solution?
func displayKeyboard(_ notification: Notification) {
if let userInfo = notification.userInfo {
if let keyboardSize = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue {
myTableView.contentInset = UIEdgeInsetsMake(0, 0, keyboardSize.height, 0) myTableView.scrollIndicatorInsets = myTableView.contentInset
}
}
}
Replace
UIKeyboardFrameBeginUserInfoKey
with
UIKeyboardFrameEndUserInfoKey
.Hope it works .