Search code examples
objective-ciosuikeyboardnsnotifications

Difference keyboardDidShow and keyboardWillShow


I have a question. What is the difference between keyboardDidShow and keyboardWillShow? If I put this in my viewDidLoad:

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(keyboardDidShow:) 
                                             name:UIKeyboardDidShowNotification 
                                           object:nil];

What does it mean? Sorry if this is a simple question, but I am not sure. If I enable the rotation of my view, then keyboardDidShow is called twice.

Another question: keyboardWillHide? What is its functionality?

Thanks


Solution

  • keyboardWillShow is fired before the keyboard appears, keyboardDidShow is fired afterwards.

    KeyboardWillHide is fired before the keyboard disappears.