简体   繁体   English

在情节提要上在两个场景之间进行长距离筛选的技巧

[英]Tricky way to make segue between two scenes with long distance on Storyboard

I'm sorry if my question looks dumb. 抱歉,我的问题很愚蠢。 Because on my storyboard, there are many scenes. 因为在我的故事板上,有很多场景。 For example, in sceneA, I have a buttonA. 例如,在sceneA中,我有一个buttonA。 And I want to connect to sceneB when user click buttonA. 我想在用户单击buttonA时连接到sceneB。 So I create a segue between buttonA and sceneB. 因此,我在buttonA和sceneB之间创建了一个序列。

The problem is: because my storyboard is big, so distance between two scene A and B is overflow of my macbook screen, so I cannot control drag to make a segue. 问题是:因为我的故事板很大,所以两个场景A和B之间的距离超出了Macbook屏幕的范围,所以我无法控制拖动以进行选择。 The only solution I currently have is: drag the sceneB to nearer sceneA (of course can overflow some other scenes) and make the segue. 我目前唯一的解决方案是:将sceneB拖到较近的场景A(当然,可能会使其他场景溢出)并进行排序。 After that, drag the sceneB again to original position. 之后,再次将sceneB拖到原始位置。

I think there is another clever way for this task. 我认为有另一种巧妙的方法可以完成此任务。 (for example: make a segue in setting board), But I cannot find out. (例如:在安装板上进行排序),但我找不到。 Please tell me. 请告诉我。

Thanks :) 谢谢 :)

您可以通过ctrl从选择的元素拖到目标场景中来进行选择(在此之前,您很方便地将其滚动到左侧窗格的旁边),以从左侧的概述窗格中进行选择。

I suggest you to stop doing segues on the storyboard. 我建议您停止在情节提要上进行搜寻。 I had also similar situation and I've started to do segues only from code. 我也遇到过类似的情况,并且我仅从代码开始进行监视。 Segues in code are also easy and gives you more dynamic control. 代码中的Segues也很容易,并为您提供了更多的动态控制。 If you don't know how to do it, here are the steps: 如果您不知道该怎么做,请按以下步骤操作:

  1. Set Storyboard ID for your VC in Identity inspector . Identity inspector为您的VC设置情节提要ID。
  2. Grab your VC in code: 在代码中获取您的VC:

Example: 例:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SampleID"];
  1. Make a segue any way you want. 随心所欲地进行搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM