多个模态呈现(页面工作表)ViewControllers导航项错误 [英] Multiple Modally Presented (page sheet) ViewControllers Navigation Item Bug

查看:114
本文介绍了多个模态呈现(页面工作表)ViewControllers导航项错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 13.问题显示在屏幕截图上.

iOS 13. The problem is shown on the screenshot.

步骤是:

  1. 以页面样式样式打开一个视图控制器.

  1. Open one view controller modally with page sheet style.

以页面样式样式打开另一个(第二个)视图控制器.

Open another (second) view controller modally with page sheet style.

预期:没有导航栏错误

实际:请参见屏幕截图

可在此处找到源代码: https://github.com/rinat-enikeev/NavBarBug

The source code is available here: https://github.com/rinat-enikeev/NavBarBug

问题:如何解决此错误?我想以页面工作表样式模态地呈现2个视图控制器.

Question: how to fix this bug? I want to present 2 view controllers modally with page sheet style.

推荐答案

好,对于那些面临相同问题的人.解决方法是将以下代码添加到viewDidLoad方法:

Ok, for those who faced the same issue. The workaround is to add the following code to the viewDidLoad method:

if #available(iOS 13, *) {
    let appearance = navigationController?.navigationBar.standardAppearance.copy()
    navigationItem.standardAppearance = appearance
}

这篇关于多个模态呈现(页面工作表)ViewControllers导航项错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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