ios - 如何:为 UIViewController 将 UIModalPresentationStyle 从 .automatic 更改为 .fullscreen
问题描述
我尝试modalPresentationStyle
按照 Apple 文档设置为 .fullscreen。
设置modalPresentationStyle
为.fullscreen
如下代码所示后,系统仍以UIModalPresentationStyle.automatic
“系统默认值”呈现视图控制器
//Presentation Style
let homeVC = HomeController(viewModel: viewModel)
homeVC.modalPresentationStyle = UIModalPresentationStyle.fullScreen
一个名为 XCoordinator 的框架控制此应用程序中的导航,这里是一个如何完成的示例。
switch route {
case .home:
let viewModel = HomeViewModelImpl(router: anyRouter)
let viewController = HomeController(viewModel: viewModel)
return .push(viewController)
}
解决方案
设置XCoordinatorTabBarCoordinator
时有一个 rootViewController。
这里的解决方案是.modalPresentationStyle
将..fullscreen
rootViewController
rootViewController.modalPresentationStyle = .fullscreen
请注意,这必须super
在类文件中的任何方法之后调用
推荐阅读
- azure - Azure 存储 - 帐户不支持 BlobInventoryPolicy 的原因
- ansible - 用于 Raspbian 10 的 ansible nmcli
- postfix-notation - 在 RPN(后缀)计算器中实现最大运算符
- excel - 如何循环浏览 OLAP 数据透视表字段项?
- javascript - 浏览器中的本地存储不增加?
- python - 如何在保持顺序的情况下更新 numpy 数据中的非连续组
- python - 尝试在 PyGame 库上制作贝塞尔曲线
- html - 如何在wordpress中创建一页但不同的永久链接?
- python - 识别通过 Python 中的频谱图获得的每个频谱的幅度
- python-3.x - Python加权和多个OrderedDict?