i want inputAccessoryView to not to hide when keyboard dissmiss. I tried by changing the frame when keybaord hides but it not working
customView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 88))
customView.backgroundColor = UIColor.white
textview.inputAccessoryView = customView
// Tracking the keyboard status
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillBeHidden), name: UIResponder.keyboardWillHideNotification, object: nil)
@objc func keyboardWillHide(sender: NSNotification) {
self.customView.frame = CGRect(x: 0, y: self.view.frame.size.height-88, width: 10, height: 88)
}
You need to add that view on to current view. by setting it as inputAccessoryView
, You are basically adding it on first responder's view which in this case is a keyboard.
Try this -
@objc func keyboardWillHide(sender: NSNotification) {
self.customView.frame = CGRect(x: 0, y: self.view.frame.size.height-88, width: 10, height: 88)
self.view.addSubView(self.customView)
}