swift - 从一个接口控制器移动到另一个
问题描述
我试图在接口控制器中有一个倒数计时器,当时间为 0 时,我希望它对下一个接口控制器执行 segue。
有没有办法做到这一点?
if secondsLeft == 0 {
pushController(withName: "RunGameInterfaceController", context: nil)
解决方案
尝试使用 main.storyboard 在两个控制器之间创建一个 segue。
然后,给 segue 一个标识符。这可以在“Storyboard and Segue”选项卡下的右侧栏菜单上完成。
在您的代码中,而不是使用“pushController”
使用“self.performSegue(withIdentifier:“yourSegueName”,发件人:self)”
确保将“yourSegueName”替换为您的标识符,您应该可以开始使用了!
推荐阅读
- azure - 如何配置空闲笔记本的 Azure DataBricks 自动驱逐?
- docker - docker-compose 失败的说图像不存在
- android-studio - Android Studio 编辑文本为空
- java - 如何读取 ArrayList
从特定行 - cardano - Plutus Playground 客户端无法运行
- java - 将 ID 从一个函数传递到另一个函数并返回
- testing - 如何使用 bitbucket 添加多分支?
- javascript - Javascript - 未命名按钮
- python - 试图整合 paramiko 和 pyTelegramBotAPI
- javascript - javascript、CSS 和 PHP 文件夹树