Apple Watch: Status bar not visible after presenting a modal screen from page based navigation

前提是你 提交于 2019-12-18 02:42:58

问题


When i present a modal screen from a page in page based navigation, the whole screen shifts up and the status bar is no longer visible.
Here is a gif of the issue:

I am using xCode 6.2 version.
This was not happening in xCode 6.2 Beta 4..
I am not sure if this is a simulator issue or this will actually happen on a real device too.

Does anyone have the same issue? Is there a workaround?

I reported a bug to apple (20109240) and it was marked as a duplicate of (19862945), and that one is still open.
Thanks in advance


回答1:


This is a known issue in the final release that exhibits itself in two cases:

  1. When presenting a second modal controller (paging or single) over an existing paging modal controller
  2. When presenting a menu using Force Touch over a paging modal controller

This has been discussed in the Apple Developer Forums, and the only workaround I've heard about is one that I use in my app. Unfortunately, there's no simple code to share that solves the problem, so I'll describe the approach (which I'd consider messy, but workable).

First, you need to keep track of interface controller presentations. I have a framework for this, but you may have to roll your own. When a child interface controller has its willActivate called two times in a row (in other words, without a call to a different child interface controller) you can assume that a modal was presented/dismissed on top of it.

Your presenting/parent controller can then inform all children that the modal menu bug has happened, and those child controllers can unhide a replacement status bar with its own Cancel/Close button. With some work, you can recreate a pixel-perfect version of the standard status bar with identical behavior.

The final twist is to detect when your Watch app is suspended, then resumes. In that case, willActivate is also called twice. If you don't handle that situation, you'll end up unhiding the replacement status bar and have two on the screen simultaneously. Not a great scenario.

Getting this right is very tricky, but it does work. I just wish I had a simple code sample that you could inject.

Update: I pushed some of my workaround code to GitHub: https://github.com/mikeswanson/JBInterfaceController



来源:https://stackoverflow.com/questions/29311026/apple-watch-status-bar-not-visible-after-presenting-a-modal-screen-from-page-ba

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