safeAreaLayoutGuide returning wrong values on blocked rotation

淺唱寂寞╮ 提交于 2019-12-10 18:28:09

问题


In my application I do have two viewControllers:

VideoListViewController - portrait only

VideoPlayerViewController - landscape only

VideoListViewController opens VideoPlayerViewController via self.present(viewController...)

I'm blocking orientations via:

override var supportedInterfaceOrientations: UIInterfaceOrientationMask 
{
    return .portrait
}

My problem is that portrait only view receives the landspace safe area... On my VideoListViewController.layoutSubviews I printed self.safeAreaLayoutGuide.layoutFrame and it works as expected at first returning {{0, 44}, {375, 734}} (portrait mode), but then when the VideoPlayer appears in landspace rotation my portrait-only viewController gets {{44, 0}, {287, 791}}

Effect is that for a slight moment old view updates ignoring safe area and it fixes itself when ViewPlayerViewController disappears.

Did anyone had this problem ? Is there any workaround for this ?

来源:https://stackoverflow.com/questions/46933337/safearealayoutguide-returning-wrong-values-on-blocked-rotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!