Apple Watch:从基于页面的导航呈现模态屏幕后,状态栏不可见 [英] Apple Watch: Status bar not visible after presenting a modal screen from page based navigation

查看:153
本文介绍了Apple Watch:从基于页面的导航呈现模态屏幕后,状态栏不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在基于页面的导航中从页面呈现模态屏幕时,整个屏幕向上移动并且状态栏不再可见。

以下是问题的GIF:


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:

我正在使用xCode 6.2版本。

这在xCode 6.2 Beta 4中没有发生..

我不确定这是模拟器问题还是这个实际上也会在真实的设备上发生。


有没有人有同样的问题?是否有解决方法?

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?

我向苹果报告了一个错误(20109240)并且它被标记为(19862945)的副本,并且它仍然是打开。

提前致谢

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

推荐答案

这是最终版本中的一个已知问题在两种情况下:

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


  1. 在现有的分页模态控制器上呈现第二个模态控制器(分页或单个)时

  2. 使用Force Touch在分页模式控制器上显示菜单时

这已在Apple Developer论坛中讨论过,我听说过的唯一解决方法是我在我的应用中使用的解决方法。不幸的是,没有简单的代码可以分享解决问题,所以我将描述这种方法(我认为这种方法很麻烦,但是可行)。

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).

首先,你需要跟踪接口控制器演示。我有一个框架,但你可能需要自己动手。当子接口控制器的willActivate连续两次调用时(换句话说,没有调用不同的子接口控制器),您可以假设模态已在其上显示/解除。

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.

最后的转折是检测您的Watch应用程序何时被暂停,然后恢复。在这种情况下,willActivate也会被调用两次。如果你不处理这种情况,你最终会取消隐藏替换状态栏并同时在屏幕上有两个。不是很好的场景。

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.

更新:我将一些解决方法代码推送到GitHub: https://github.com/mikeswanson/JBInterfaceController

这篇关于Apple Watch:从基于页面的导航呈现模态屏幕后,状态栏不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆