ios - 弹出显示没有迅速覆盖整个屏幕
问题描述
我是 iOS 开发的新手,我在屏幕上单击按钮时显示了弹出窗口,但它没有覆盖整个屏幕,显示弹出窗口的代码
let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "sbPopUpID") as! PopUpViewController
self.addChild(popOverVC)
popOverVC.view.frame = self.view.frame
self.view.addSubview(popOverVC.view)
popOverVC.didMove(toParent: self)
解决方案
您可以简单地呈现一个:
let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "sbPopUpID") as! PopUpViewController
// This one makes popOverVC fullscreen. In some cases you would like to use `.overFullScreen` just test what fits your scenario better
popOverVC = .fullScreen
// if you need it without animation, just call with animated: false
self.present(popOverVC, animated: true, completion: nil)
另外我会推荐阅读这篇文章
和这个
更好地了解正在发生的事情:)
推荐阅读
- swift - 在 WKWebView 中提交 HTML
- java - 比较不适用于某些值
- javascript - 在 a 之后显示更多文本场地
- javascript - R Shiny:使用闪亮的 JS 从 Datatable 获取信息
- sql - 连接中的行太多
- azure - 使用 MS Graph API 在 ADB2C 中重置没有 Directory.AccessAsUser.All 权限的用户密码
- java - 为什么kotlin没有按照android的要求为片段创建一个Required的空公共构造函数?
- snowflake-schema - 雪花外部阶段 - 错误访问被拒绝
- python - 时间序列分析,使用 Kwiatkowski–Phillips–Schmidt–Shin (KPSS) 检查平稳性
- date - Power BI 如何从日期中提取月份和年份