How to detect undock, dock, or split pressed on iPad (iOS 5)

I am trying to detect if the dock key is pressed or not on my iPad. This dock key is a new feature in iOS 5. When you press this key, the keyboard disappears. I need to find this out. When this key is pressed, I need to change the frame of my view, but I was unable to receive any event by pressing this key.

I am trying to use the following function:

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    NSLog(@"TEXT: %@", text);
    return YES;
}

      

When I pressed "A" this function is called and TEXT: A is printed, but when the dock key is pressed, this function was not called!

Is there a way to detect the dock key on iPad? For clarification, the dock key is available on iPad (iOS 5 only) in the lower right corner of the keyboard.

ANSWER::

I used the following code in viewDidLoad:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide) name:UIKeyboardWillHideNotification object:nil];

      

and i got event in method - (void) keyboardWillHide

-(void)keyboardWillHide
{
    NSLog(@"Pressed...");
}

      

thanks borrrden.

+3


source to share


1 answer


When the user presses the dock button, you will be notified via the UIKeyboardWillHideNotification from the NSNotificationCenter.



+1


source







All Articles