如何在没有关联的UI元素的情况下在iOS中创建segue [英] How to create a segue in iOS without having an associated UI Element

查看:98
本文介绍了如何在没有关联的UI元素的情况下在iOS中创建segue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我首先加载ViewController1。它做了一堆背景管家工作然后转到ViewController2。



要对ViewController2执行Segue,我知道的唯一方法就是添加一个BUTTON (用户永远不需要查看或使用)然后通过按住控件并拖动来将该按钮中的segue添加到ViewController2。



我的问题是 - 由于我在这里真的不需要ViewController1中的按钮,我怎样才能创建一个Segue然后使用 performSegueWithIdentifier(segue_LoginToStart,sender:nil) <在代码中执行/ p>

解决方案

步骤-1



- 在故事板中选择您的存储板名称(黄色按钮)



步骤-2



- 按 Ctrl +右点击 - 转到你的des视图控制器





步骤-3



- 在属性中提供seque名称



步骤-4



在您想要的地方拨打以下行

  performSegueWithIdentifier(segue_LoginToStart,发件人:nil)


I load "ViewController1" first. It does a bunch of background housekeeping work and then goes to "ViewController2".

To perform a Segue to "ViewController2", the only way I know is to add a BUTTON (which user never needs to see or use) and then add a segue from that button to the "ViewController2" by holding down control and dragging.

My question is -- Since I dont really need the button in ViewController1 here, how can I just create a Segue and then do it in code using performSegueWithIdentifier("segue_LoginToStart", sender: nil)

解决方案

Step -1

-- select your stoyboard name (Yellow button) in Storyboard

Step -2

-- Press Ctrl + right click -- segue to your destination view controller

Step -3

-- give the seque name in attribute

Step -4

call the following line where you want

 performSegueWithIdentifier("segue_LoginToStart", sender: nil)

这篇关于如何在没有关联的UI元素的情况下在iOS中创建segue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆