ios – 在横向模式下,为什么iPad键盘高度为1024px?

ios – 在横向模式下,为什么iPad键盘高度为1024px?,第1张

概述我在本周早些时候遇到过这个问题,刚才又遇到了这个问题.当用户处于iPad的横向模式时,当键盘出现在屏幕上时,我正在设置键盘偏移. iPad的尺寸为1024 x 768. - (void) keyboardWasShown:(NSNotification *)nsNotification { NSDictionary *userInfo = [nsNotification userInfo] 我在本周早些时候遇到过这个问题,刚才又遇到了这个问题.当用户处于iPad的横向模式时,当键盘出现在屏幕上时,我正在设置键盘偏移. iPad的尺寸为1024 x 768.

- (voID) keyboarDWasShown:(NSNotification *)nsNotification {    NSDictionary *userInfo = [nsNotification userInfo];    CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;    NSLog(@"Height: %f WIDth: %f",kbSize.height,kbSize.wIDth);    // Portrait:    Height: 264.000000  WIDth: 768.000000    // Landscape:   Height: 1024.000000 WIDth: 352.000000}

怎么键盘的高度可以是1024?这意味着键盘现在覆盖整个屏幕.我认为高度应该是352,宽度应该是1024.这是一个错误吗?

解决方法 从 http://developer.apple.com/library/ios/documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/doc/uid/TP40006817-CH3-SW27起

UIKeyboardFrameBeginUserInfoKey

The key for an NSValue object containing a CGRect that IDentifIEs the start frame of the keyboard in screen coordinates. These coordinates do not take into account any rotation factors applIEd to the window’s contents as a result of interface orIEntation changes. Thus,you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to vIEw coordinates (using the convertRect:fromVIEw: method) before using it.

总结

以上是内存溢出为你收集整理的ios – 在横向模式下,为什么iPad键盘高度为1024px?全部内容,希望文章能够帮你解决ios – 在横向模式下,为什么iPad键盘高度为1024px?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1082614.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存