Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

enter image description here

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

like image 553
Vojce kushevski Avatar asked Mar 27 '15 22:03

Vojce kushevski


1 Answers

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

like image 184
Mike Swanson Avatar answered Oct 18 '22 23:10

Mike Swanson