我可以更改键盘方向吗? [英] Can I change the keyboard orientation?
问题描述
例如,我使用此代码关闭自动旋转
For example I turn off autorotation with this code
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return 0;
}
我的按钮,标签,文本字段和其他对象可以根据设备的当前方向旋转.但是键盘不想旋转=/ 我如何旋转键盘或无法旋转键盘.谁知道? 请帮忙) http://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) http://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!)
这篇关于我可以更改键盘方向吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!