我的 UIView 的一部分覆盖了 iPad 的键盘。
您看到的 View 只是我作为 subview 添加到主视图的 UIView。显示键盘时,我会向上移动 View 。
有没有人以前见过这个?
编辑
当显示键盘时,我将 View 向上移动:
[UIView animateWithDuration:SHOW_KEYBOARD_ANIMATION_DURATION animations:^{
CGRect frame = self.currentViewController.view.frame;
frame.origin.y -= SHOW_KEYBOARD_OFFSET;
self.currentViewController.view.frame = frame;
}];
编辑
我使用以下代码添加 View :
[UIView transitionFromView:fromView toView:toView duration:0.3f options:UIViewAnimationOptionTransitionCrossDissolve completion:nil];
最佳答案
您是在显示键盘之前还是之后调用代码将 View 移开?换句话说,您是在注册 UIKeyboardWillShowNotification 还是 UIKeyboardDidShowNotification?
我不确定您从哪里获得键盘尺寸?再看看苹果的示例代码,见http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html ,向下滚动到位于键盘下方的移动内容部分。
关于ios - 为什么我的 UIView 的一部分覆盖了键盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10442354/