简体   繁体   English

在 Storyboard 中按住 Control 并拖动 UIView 以显示 controller?

[英]Control-drag UIView in Storyboard to present a controller?

I know it's possible to control-drag a table view cell in order to present a controller from the storyboard, but I can't seem to be able to do the same for a UIView .我知道可以控制拖动表格视图单元格以从 storyboard 中显示 controller,但我似乎无法对UIView执行相同操作。 What reason is there for this?这有什么原因? Why can't I control-drag a UIView in the storyboard to present a controller?为什么我不能控制拖动 storyboard 中的 UIView 来呈现 controller?

Using the Xcode interface builder through storyboard you need to add a gesture to the UIView.通过 storyboard 使用 Xcode 界面构建器,您需要向 UIView 添加手势。

  1. Drag a tap gesture and place it on top of the related UIView.拖动轻击手势并将其放在相关 UIView 的顶部。 (The gesture will appear at the bottom of elements in the controllers structure on the left.) (手势将出现在左侧控制器结构中元素的底部。)
  2. Now you can Ctrl+Drag from that gesture to present your controller as you mentioned.现在,您可以按 Ctrl+拖动该手势来展示您提到的 controller。

Hope that solves your problem.希望能解决您的问题。

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

相关问题 无法控制在故事板中的可可触摸uiview类和子视图之间的xcode中拖动 - Cannot control-drag in xcode between cocoa touch uiview class and subview in storyboard 故事板:按住 - 从条形按钮拖动到“退出”项 - Storyboard: Control-drag from a bar button to the Exit item 无法控制从表视图拖动到情节提要中的详细信息视图 - Not able to control-drag from a Table View to a detail view in a storyboard IOS - 控制 - 拖动按钮不起作用 - IOS - control-drag of a button is not working 无法控制将UIButton拖动到IBOutletCollection - can't control-drag UIButton to IBOutletCollection 无法控制拖动到ViewController.swift - Cannot Control-Drag into ViewController.swift 为什么我需要控制某种UI小部件并将其拖动到代表视图控制器的黄色区域中? - Why do I need to control-drag some kind of UI-widgets into yellow sphere representing the view controller? 控制 - 拖动以在Xcode 5中创建IBAction以关闭键盘? - Control-drag to create IBAction in Xcode 5 to dismiss keyboard? 界面生成器:更改控件 - 拖动IBOutlet键盘快捷键 - Interface Builder: Change control-drag IBOutlet keyboard shortcut Xcode中的Control-drag给出了出口,但是UIButton没有动作。 为什么? - Control-drag in Xcode gives outlets, but no action for UIButton. Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM