ios - 如何调整呈现视图的大小 - Swift 5 (Xcode)
问题描述
我有一个按钮,它将引导到集合视图控制器drawDetails_VC。
func showController() {
let drawDetails_VC = DrawDetails(collectionViewLayout: UICollectionViewFlowLayout())
navigationController?.navigationBar.tintColor = UIColor.white
let navController = CustomNavigationController(rootViewController: drawDetails_VC)
present(navController, animated: true, completion: nil)
}
更新到Swift 5后,呈现的集合视图Page Sheet没有覆盖全屏。
我尝试了几个小时,但没有得到我想要的。
呈现的页面页表如何覆盖整个屏幕而不是如上图。以及如何以编程方式获得呈现的控制器页面表的宽度
解决方案
将视图控制器的模态演示样式设置为.fullScreen
或.overFullScreen
。试试下面的代码示例。
func showController() {
let drawDetails_VC = DrawDetails(collectionViewLayout: UICollectionViewFlowLayout())
navigationController?.navigationBar.tintColor = .white
let navController = CustomNavigationController(rootViewController: drawDetails_VC)
navController.modalPresentationStyle = .fullScreen
present(navController, animated: true, completion: nil)
}
推荐阅读
- reactjs - 将一种样式应用于具有样式组件的组件数组反应
- python - 使列表中两个字符串之间的汉明距离最多为 3
- flutter - Flutter:用 switch 和递归调用中断 forEach
- azure-devops - 公共项目捐赠401
- arrays - Wordpress 从 user_meta img 获取 fullurl
- python - 如何从最弱到最强打印前k行索引
- python - 在 '@' 之后使用 argparse 的 fromfile_prefix_chars='@' 重新使用参数
- c++ - 编译器 C2491 错误:解决方案需要丢失数据?
- python - 向 df 添加一列,其中包含 df 中不同列的值的计数?
- java - 使用 JScrollPane 时不可靠的容器宽度