为什么我不能在Xcode中创建动作? [英] Why can't I create an Action in Xcode?

查看:102
本文介绍了为什么我不能在Xcode中创建动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按照如何在Xcode 4.3.1中的类中添加动作或插座?,或Apple的First iOS App教程,Action没有选项。只有插座和插座连接选项。我在做什么错了?

When I follow the instructions at How do I add an action or outlet to a class in Xcode 4.3.1?, or Apple's First iOS App tutorial, there's no option for Action. There is only options for Outlet and Outlet Connections. What am I doing wrong?

推荐答案

您只能将操作连接到 UIControl 的子类。

You can connect actions only to subclasses of UIControl.

您尝试通过 UIView 创建操作,而不是UIControl的子类,没有动作。

You are trying to create an action from a UIView, which is not a subclass of UIControl and does not have actions.

从按钮而不是主视图开始拖动

Start the drag from the button, and not the "main view"

这篇关于为什么我不能在Xcode中创建动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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