有一个选项卡栏应用程序,其中一个选项卡固定在横向,其余选项卡固定在纵向。如果先打开具有横向方向的选项卡,然后打开具有纵向方向的选项卡,则键盘在纵向选项卡中以错误的方向显示,并且键盘被部分裁剪。这种情况只在iOS 8中发生。在iOS 7中,方向看起来很好。我附上了它们在iOS 7和iOS 8中的外观截图。
提前感谢


发布于 2015-09-23 16:26:48
要关闭键盘,您可以使用以下代码:
- (void)viewDidLoad {
[super viewDidLoad];
_currentOrientation = 1;
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
[self orientationChanged];
}
-(void)orientationChanged{
if ((self.interfaceOrientation==UIInterfaceOrientationPortrait || self.interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown ) && (_currentOrientation==1 || _currentOrientation==3)) {
_currentOrientation=2;
[self.view endEditing:YES]
}
else{
if ((self.interfaceOrientation==UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation==UIInterfaceOrientationLandscapeRight) && (_currentOrientation==1 || _currentOrientation==2)) {
_currentOrientation=3;
[self.view endEditing:YES]
}
}
}https://stackoverflow.com/questions/32734376
复制相似问题