- (voID)vIEwWillAppear:(BOol)animated{ [super vIEwWillAppear:animated]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addobserver:self selector:@selector(keyboarDWillShow:) name:UIKeyboarDWillShowNotification object:nil]; [nc addobserver:self selector:@selector(keyboarDWillHIDe:) name:UIKeyboarDWillHIDeNotification object:nil];}- (voID)vIEwWilldisappear:(BOol)animated{ [super vIEwWilldisappear:animated]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:nil object:nil];}- (voID)keyboarDWillShow:(NSNotification *)aNotification{ NSValue *animationCurve = [[aNotification userInfo] valueForKey:UIKeyboardAnimationCurveUserInfoKey]; UIVIEwAnimationCurve curve; [animationCurve getValue:&curve]; NSValue *animationDuration = [[aNotification userInfo] valueForKey:UIKeyboardAnimationDurationUserInfoKey]; NSTimeInterval duration; [animationDuration getValue:&duration]; NSValue *endingFrame = [[aNotification userInfo] valueForKey:UIKeyboardFrameEndUserInfoKey]; CGRect frame; [endingFrame getValue:&frame]; [UIVIEw beginAnimations:@"keyboarDWillShow" context:bodyVIEw]; [UIVIEw setAnimationCurve:curve]; [UIVIEw setAnimationDuration:duration]; // Re-draw code here. [UIVIEw commitAnimations];}- (voID)keyboarDWillHIDe:(NSNotification *)aNotification{ NSValue *animationCurve = [[aNotification userInfo] valueForKey:UIKeyboardAnimationCurveUserInfoKey]; UIVIEwAnimationCurve curve; [animationCurve getValue:&curve]; NSValue *animationDuration = [[aNotification userInfo] valueForKey:UIKeyboardAnimationDurationUserInfoKey]; NSTimeInterval duration; [animationDuration getValue:&duration]; [UIVIEw beginAnimations:@"keyboarDWillHIDe" context:bodyVIEw]; [UIVIEw setAnimationCurve:curve]; [UIVIEw setAnimationDuration:duration]; // Re-draw code here [UIVIEw commitAnimations]; }
我的问题是:在旋转过程中我如何处理键盘尺寸?旋转iPad时,我没有收到任何键盘通知,但键盘的大小发生了显着变化.理想情况下,我只需将键盘在横向模式下重叠的数量调整为contentSize属性的高度,但是如果不在两个方向上对键盘的高度进行硬编码,我就看不到这样做的好方法.不想做.
解决方法 我偶然发现了这个调试的答案.事实证明,当iPad从纵向旋转到横向时,肖像键盘会在横向键盘出现之前隐藏(并发送其通知)(并发送其通知).所以,只要你说明这一点,你就可以了. 总结以上是内存溢出为你收集整理的旋转后获得iPad屏幕键盘的大小全部内容,希望文章能够帮你解决旋转后获得iPad屏幕键盘的大小所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)