Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is part of my UIView covering the keyboard?

Part of my UIView is covering the iPad's keyboard.

enter image description here

The view you're seeing is simply a UIView I've added as a subview to my main view. When the keyboard is shown, I do shift the view up.

Has anyone ever seen this before?

EDIT

When the keyboard is shown, I move the view up:

[UIView animateWithDuration:SHOW_KEYBOARD_ANIMATION_DURATION animations:^{
    CGRect frame = self.currentViewController.view.frame;
    frame.origin.y -= SHOW_KEYBOARD_OFFSET;

    self.currentViewController.view.frame = frame;
}];

EDIT

I use the follow code to add the view:

[UIView transitionFromView:fromView toView:toView duration:0.3f options:UIViewAnimationOptionTransitionCrossDissolve completion:nil];
like image 412
Quentamia Avatar asked May 04 '12 03:05

Quentamia


1 Answers

Are you calling the code to move the view out of the way before or after the keyboard is displayed? In other words, are you registering for UIKeyboardWillShowNotification or UIKeyboardDidShowNotification?

I'm not sure where you are getting the keyboard size? Take a look at Apple's sample code again, see http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html, scroll down to the section on moving content that is located under the keyboard.

like image 151
Kate Morris Avatar answered Sep 17 '22 08:09

Kate Morris