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

查看:50
本文介绍了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?

我向 Apple (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 开发者论坛中讨论过,我听说过的唯一解决方法是我在我的应用中使用的方法.不幸的是,没有简单的代码可以解决这个问题,所以我将描述该方法(我认为这很麻烦,但可行).

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/JB接口控制器

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

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