Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove keyboard notification when ViewController disappears

How can I remove keyboard notification?

I put observer on keyboard open and close.

I change the view size depend on keyboard is open or close.

like image 317
Vijay Kahar Avatar asked Mar 05 '23 06:03

Vijay Kahar


1 Answers

Try this to remove keyboard open show observers,

NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)

you should remove observers either in deinit Or viewDidDisappear as per your requirement.

like image 78
Dhaval Bhimani Avatar answered Apr 08 '23 15:04

Dhaval Bhimani