gpt4 book ai didi

ios - 呈现模态视图 Controller ,但不隐藏导航栏

转载 作者:搜寻专家 更新时间:2023-11-01 07:06:46 27 4
gpt4 key购买 nike

我以模态方式呈现一个带有半透明 View 的 viewController。这是一个自定义事件指示器。我希望它覆盖 View ,但让导航栏和标签栏可见且可访问。

文档和几个 SO 答案(例如 Presenting a Modal View Controller hides the Navigation Bar)似乎表明将模态呈现在导航 Controller 上应该可以实现这一点。但是当我这样做时,它正确显示了标签栏,但覆盖了导航栏。

有什么想法吗?相关代码如下:

let spinnerVC = SpinnerViewController()
spinnerVC.modalPresentationStyle = .overCurrentContext
spinnerVC.modalTransitionStyle = .crossDissolve
self.navigationController?.present(spinnerVC, animated: true, completion: nil)
//self.navigationController is definitely not nil

最佳答案

您可以出示您的 viewcontroller添加为 rootViewControllernavigationController然后将其呈现在当前 viewController 上像这样:

let spinnerVC = SpinnerViewController()
let navVC = UINavigationController(rootViewController:spinnerVC)
navVC.modalPresentationStyle = .overCurrentContext
navVC.modalTransitionStyle = .crossDissolve
self.present(navVC, animated: true, completion: nil)

关于ios - 呈现模态视图 Controller ,但不隐藏导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47565513/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com