ios - 如何从 viewcontroller.swift 文件导航到 *.storyboard 文件中的相应场景?
问题描述
Xcode 中是否有一种方法(组合键、上下文菜单)可以从自定义 UIViewController(AViewController.swift
例如)文件快速导航到情节提要中的屏幕,该屏幕已AViewController.swift
在身份检查器选项卡中显示为自定义类?
解决方案
您需要在情节提要的身份检查器中设置情节提要 ID。然后推动:
let vc = storyBoard.instantiateViewController(withIdentifier: identifier)
vc.modalPresentationStyle = .fullScreen
self.navigationController?.pushViewController(vc, animated: true)
标识符是故事板ID
或者您可以通过以下方式呈现它:
let vc = storyBoard.instantiateViewController(withIdentifier: identifier)
vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true)
推荐阅读
- spring - 在 Spring Boot 中将密码保存到数据库的时间点
- javascript - 创建具有相同键的对象数组
- java - 使用 Apache Curator 时,为什么创建 zNode 会导致 NoNodeException
- python - 当我使用丰富的库添加颜色时,为什么会影响它周围的符号?有没有办法阻止这种情况发生?
- php - 如何通过 php 中的清理键访问数组的值?
- laravel - Laravel 8:调用 POST/PUT 方法时出现 302 重定向
- javascript - 根据文档在故事书中设置 sass-loader 但不编译 sass
- javascript - 如何从颤动的消息集合中获取最后一条消息
- html - 调整/拉伸图像大小以适合 div 类 css
- java - 如何验证路径变量类型:错误 400 参数错误,服务器没有日志,没有错误消息