我可以更改键盘方向吗?

编程入门 行业动态 更新时间:2024-10-28 11:25:24
本文介绍了我可以更改键盘方向吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

例如,我使用此代码关闭自动旋转

For example I turn off autorotation with this code

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return NO; } -(BOOL)shouldAutorotate { return NO; } -(NSUInteger)supportedInterfaceOrientations { return 0; }

我的按钮,标签,文本字段和其他对象可以根据设备的当前方向旋转.但是键盘不想旋转=/ 我如何旋转键盘或无法旋转键盘.谁知道? 请帮忙) www.pictureshack.ru/images/8145_Snimok_ekrana_05_11_2013_18_55_00_>

And my buttons, labels, textFields and other object can rotate according to the current orientation of the device. But keyboard doesn't want to rotate=/ How i can rotate keyboard or i can't. Who knows? Please help) www.pictureshack.ru/images/8145_Snimok_ekrana_05_11_2013_18_55_00_s_Simulyatora_iOS.png

推荐答案

确定.事实证明,决定很简单. 在检查设备方向的方法中,我添加了此代码,并且该代码可以正常工作.

OK. Decision proved to be a simple. In my method where i checked device orientation, i add this code and it's working.

if (deviceOrientation == UIDeviceOrientationPortrait){ [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; } else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown){ [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown animated:NO]; } else if (deviceOrientation == UIDeviceOrientationLandscapeLeft){ [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; } else if (deviceOrientation == UIDeviceOrientationLandscapeRight){ [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO]; }

希望这对某人有帮助!)

Hope this helps to someone!)

更多推荐

我可以更改键盘方向吗?

本文发布于:2023-10-22 20:03:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1518564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:键盘   方向

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!