首页 > 解决方案 > 导航栏未正确显示(显示为浮动而不是修复栏)

问题描述

使用导航栏,为什么它显示浮动卡片视图而不是修复导航栏?

显示为固定导航栏的配置是什么?

标签: iosuinavigationbarxcode11

解决方案


在 iOS 13 或更高版本上,您必须在呈现之前将UIViewController 设置为modalPresentationStyle.fullScreen

例如:

let viewController = UIViewController()
viewController.modalPresentationStyle = .fullScreen
present(viewController, animated: true, completion: nil)

您必须为您呈现的每个 ViewController 执行此操作。


推荐阅读