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

问题描述 投票:-1回答:1

我尝试根据Apple文档将modalPresentationStyle设置为.fullscreen。

在将下面的代码中显示的modalPresentationStyle设置为.fullscreen之后,系统仍然在UIModalPresentationStyle.automatic“系统默认值”中显示viewControllers

//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)

}
ios swift rx-swift ios13 uimodalpresentationstyle
1个回答
0
投票

[X0设置XCoordinator时,TabBarCoordinator具有rootViewController。

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

rootViewController.modalPresentationStyle = .fullscreen

注意必须在类文件中的任何super方法之后调用此>]

© www.soinside.com 2019 - 2024. All rights reserved.