首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何:将UIModalPresentationStyle从.automatic更改为UIViewController的.fullscreen

如何:将UIModalPresentationStyle从.automatic更改为UIViewController的.fullscreen
EN

Stack Overflow用户
提问于 2019-10-09 03:09:17
回答 1查看 502关注 0票数 0

我尝试按照苹果的文档将modalPresentationStyle设置为.fullscreen。

在将modalPresentationStyle设置为.fullscreen (如以下代码所示)后,系统仍以“UIModalPresentationStyle.automatic system default”的形式显示该viewControllers

代码语言:javascript
复制
//Presentation Style
let homeVC = HomeController(viewModel: viewModel)
homeVC.modalPresentationStyle = UIModalPresentationStyle.fullScreen

一个名为XCoordinator的框架控制这个应用程序中的导航,下面是一个如何实现的示例。

代码语言:javascript
复制
switch route { 
case .home: 

let viewModel = HomeViewModelImpl(router: anyRouter) 
let viewController = HomeController(viewModel: viewModel) 

return .push(viewController)

}
EN

回答 1

Stack Overflow用户

发布于 2019-10-11 23:59:50

当设置了XCoordinator时,TabBarCoordinator具有rootViewController。

这里的解决方案是将.modalPresentationStyle设置为关闭rootViewController.fullscreen

rootViewController.modalPresentationStyle = .fullscreen

请注意,这必须在类文件中的任何super方法之后调用

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58292631

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档