2

In my iOS app, I am modally presenting a View Controller (AVPlayerViewController, in this case) using a transition.

At the start of the transition, the Status Bar disappears instantly and yanks up the contents of the app in an ugly jerk, before the animation (of whatever kind--crossfade, cover vertical) hides the underlying stack of view controllers. The new modally presented VC has a status bar on it.

I'd like to not have the status bar vanish at the start of the modal presentation animation.

I set up a blank project and mocked the same basic structure of my app, and when a view controller is presented, the status bar remains stationary during the transition.

What would cause the status bar to vanish at the start of a modal presentation animation?

(Tested on iOS 11 on iPhone X and iOS 10/9 on simulators.)

EDIT:

To perform the presentation, the root view controller of the app is listening for a notification and calling, roughly:

let vc = AVPlayerViewController()
// configure the player
self.present(vc, animated: true) {
    vc.player?.play()
}

This is what produces the odd vanishment.

Interestingly, when I go into the Storyboard and set up a Modal Segue (to a blank view controller) from that same root view controller, triggered off a randomly-added-button, the resultant transition is smooth.

Another data point is that when I turn off animation in present(:animated:completion:) the status bar stays put until the modal is covering it.

Matt Mc
  • 8,882
  • 6
  • 53
  • 89
  • "What would cause the status bar to vanish at the start of a modal presentation animation?" Something that is _different_ in _your_ project from the blank project. But whatever it is, you have not told us about it. You haven't told us _anything_ about what you're doing. – matt Feb 19 '18 at 00:43
  • @matt Valid. Funny that I have often seen your comments on SO pointing out such lack of data in peoples' questions, and now have experienced it myself. I put a little more data, but it may still not be enough to elicit help. When I resolve the issue, I'll answer it and re-frame the question so that it is useful. – Matt Mc Feb 19 '18 at 01:04
  • Yes, the joke is that I often say, "Try this with a plain vanilla project straight from the template", and you've already done that test — which is brilliant. So we are 9/10 of the way there: we know that _you_ are doing something that causes the issue. But, as I say, you have not given us a clue as to what it might be. :) – matt Feb 19 '18 at 01:07
  • If you can reproduce the problem in a very minimal project and post it, I'll be glad to look at it. No guarantees I can figure it out but it's always fun to try. – matt Feb 19 '18 at 01:08
  • @matt Thanks for the offer! In the course of attempting to reproduce the problem for you, I discovered that this occurred when modally presenting an AVPlayerViewController specifically, and only on iOS 9 and iOS 10. So...I'm not sure why that occurs, but my solution for now is to disable animation on the presentation. – Matt Mc Feb 19 '18 at 02:07

1 Answers1

1

In my case, this was specifically an issue when modally presenting an AVPlayerViewController in iOS 9 and iOS 10. The issue seems to be resolved in iOS 11.

What I was seeing on iOS 11 was a slightly different issue--that of modally presenting an AVPlayerViewController in forced landscape mode, which was causing the status bar to flip orientation at the start of the animation.

Matt Mc
  • 8,882
  • 6
  • 53
  • 89