How to connect multiple buttons in a storyboard to a single action?(如何将情节提要中的多个按钮连接到单个动作?)
问题描述
我目前正在使用 Xcode 4.6,我只是想知道如何在不同的 UIView 中选择多个按钮,但在单个视图控制器下.CMD 点击似乎不起作用.我需要这个功能,因为在 Xcode 4.6 中,让 IB 上的两个按钮共享相同操作的唯一方法是一次选择它们,然后将操作拖到您的视图控制器.
I'm currently using Xcode 4.6 and I'm simply wondering how to select multiple buttons across different UIViews, but under a single view controller. CMD clicking doesn't seem to work. I need this functionality because in Xcode 4.6 the only way to let two buttons on IB to share the same action is to select them at once and then drag the action to your view controller.
我的最终目标是使用 Xcode 4.6 中的情节提要在两个不同的 UIView 上获得两个不同的按钮以匹配相同的操作.有没有办法做到这一点?
My ultimate goal is to get two different buttons on two different UIViews to match the same action using storyboards in Xcode 4.6. Is there a way to do this?
我目前正在使用 Xcode 4.6.1 没有任何运气,升级到 4.6.2.
I'm currently using Xcode 4.6.1 without any luck, upgrading to 4.6.2.
推荐答案
您可以将多个按钮连接到一个操作,而无需一次全部选中.
You can connect multiple buttons to a single action without selecting them all at once.
但是,在创建动作之后,您需要保存包含该动作的源文件,然后 Xcode 才能让您将另一个控件连接到该动作.
However, after creating the action, you need to save the source file containing the action before Xcode will let you connect another control to the action.
我用 Xcode 4.6.2 做到了这一点:
I did this with Xcode 4.6.2:
这篇关于如何将情节提要中的多个按钮连接到单个动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将情节提要中的多个按钮连接到单个动作?


基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01