无法创建 IBAction ctrl-dragging UIButton to ViewController (Xcode Version 7.2) [英] Can't create IBAction ctrl-dragging UIButton to ViewController (Xcode Version 7.2)

查看:15
本文介绍了无法创建 IBAction ctrl-dragging UIButton to ViewController (Xcode Version 7.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我创建应用程序的过程中,xcode 退出允许我按住 ctrl 将 UIButtons 拖动到 VC 以创建 IBActions.这发生在每个 VC 上(总共 9 个).不过,它确实允许创建 Outlets.(请看图片 -> 没有显示动作选择)

In the middle of my creating the app, xcode quit allowing me to ctrl-drag UIButtons to VCs for creating IBActions. This happens on every VC (nine in all). It does allow for creating Outlets, though. (Pls see image -> no Action selection is showing)

xcode 版本 7.2 (7C68) 构建目标是 ios9.

xcode Version 7.2 (7C68) build target is ios9.

有没有办法解决这个问题?

Is there a way to fix this?

推荐答案

一些尝试:

确保您使用已发送事件"之一来创建 IBAction - 而不是触发式 Segue(将执行您所描述的操作)或其他连接.

Make sure you are using one of the "Sent Events" to create the IBAction - not a Triggered Segue (that will do what you are describing) or other connection.

尝试不只是通过按住Ctrl键拖动,而是通过右键菜单或连接菜单进行连接.

Try connecting not just via Ctr-drag, but via the right click menu or connections menu.

尝试添加代码:

@IBAction func myAction()
{ }

...应该会出现一个清晰的圆圈,可以通过拖动到IB中的按钮来连接.这将创建一个 Touch Up Inside 事件.

... a clear circle should appear, which can be connected via dragging to the button in IB. This will create a Touch Up Inside event.

最后,重新启动您的项目并重试.

Finally, restart your project and try again.

这篇关于无法创建 IBAction ctrl-dragging UIButton to ViewController (Xcode Version 7.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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