safeAreaLayoutGuide returning wrong values on bloc

2019-07-05 06:05发布

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 ?

0条回答
登录 后发表回答