首页 文章

iPad - 在iPad上关闭全屏模态视图控制器后,屏幕部分不再接收触摸事件

提问于
浏览
3

我的iPad上的(全屏)主视图顶部有工具栏 . 工具栏有一个barButtonItem,按下后会显示一个弹出窗口 .

在popover中,我有一个UIButton,按下时,告诉委托(主视图控制器)关闭弹出窗口并显示整页模态视图 .

一切正常 .

当我关闭模态视图时,弹出窗口占用的屏幕区域(包括主视图和工具栏按钮)不再响应触摸事件 .

如果我旋转设备并且仅在横向模式下发生此问题,则此问题会自行解决 .

有什么建议?

更新:在模拟器中运行时,只有在实际的iPad上才会发生此错误 .

委托方法我必须关闭全屏模态视图..

- (void)fullScreenViewControllerDidFinish:(FullScreenWebViewController *)fullScreenWebView {
    [self dismissViewControllerAnimated:YES completion:^{
        [self setFullScreenWVC:nil];
        [[self view] setNeedsLayout]; //Does't fix the issue
    }];
}

更新:使用Instruments,我已经让iPad向我展示它是如何布置子视图的 . 当模态视图被解除时,看起来它认为iPad处于人像状态,但设备显然处于风景中 .

enter image description here

2 回答

  • 0

    我解决了这个问题 .

    我在用

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    

    代替

    UIDeviceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
    

    由于某种原因,iPad没有得到正确的方向 .

    谢谢你的帮助 .

  • 2

    我可能会误解你的问题,但是我会建议在模态视图被解除后尝试在主视图中调用“setNeedsLayout” . 这应该会触发视图布局的自动调整大小,如果没有自动调整大小,可能会解决问题 .

    请查看此链接以获取更多信息:

    http://developer.apple.com/library/ios/ipad/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/setNeedsLayout

相关问题