ios - 将 UIViewController 呈现为弹出框
问题描述
我将我的应用程序设置为NewHelpRequestViewController
通过单击数组中的最后一个单元格来连接到另一个。我想要做的是将视图控制器作为弹出窗口打开。
class MainViewController : UITableViewController, UIPopoverPresentationControllerDelegate {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
if indexPath.row == questionViewCellArray.count-1 {
self.performSegue(withIdentifier: "showNewRequest" , sender : self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showNewRequest" {
if let controller = segue.destination as? NewHelpRequestViewController {
controller.popoverPresentationController!.delegate = self
controller.preferredContentSize = CGSize(width: 200, height: 300)
}
}
}
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
现在它将打开NewHelpRequestViewController
,没有任何问题或错误。我链接了我可以链接的相关代码。如果我需要展示其他内容,请告诉我。
我还应该提到这是针对 iPhone 的。
解决方案
推荐阅读
- autocad - AutoCAD中的导入层状态如何工作?
- linux - 带有升序后缀的 mkdir 和 mv 一个文件到每个文件夹
- javascript - 基于用户权限的隐藏/显示元素 - Fliplet
- webserver - 如何将 Web 服务器 caddy 配置为返回 404 错误?
- asp.net-core - MassTransit Saga:注入范围服务的正确方法是什么?
- flutter - 参数类型'列表
>' 不能分配给参数类型 'List ' - eclipse - 无法在 spark local 中生成 badrecord 文件
- laravel - 错误:EPERM:不允许操作,找不到 mkdir 'C:\Users\Sourov' 命令:webpack
- node.js - config.js中的Azure nodejs Webapp“未定义未捕获的参考错误模块”
- node.js - mongodb typescript 类型检查