I've following code to adjust scroll view inset. The content inside scroll view goes below the keyboard limit as shown in screen recording - https://i.sstatic.net/6itwk.jpg
How do I fix this so that bottom of bottomView stick to the top of keyboard and doesn't scroll up or down?
@objc func keyboardWillShow(notification:NSNotification) {
let userInfo = notification.userInfo!
let keyboardFrame:CGRect = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let kbSize = keyboardFrame.size
let contentInset:UIEdgeInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: kbSize.height, right: 0.0)
scrollView.contentInset = contentInset
scrollView.scrollIndicatorInsets = contentInset
}
Using scrollView.contentInset will not fix you view above kb, it will scroll up and down as you are seeing it in your case. This solution is from Apple's code which is good to show the textView up above kb only and doesn't stick the bottom of text view above kb.
You need to move up the entire self.view by kb height.