如何将情节提要中的多个按钮连接到单个动作?

2023-07-09移动开发问题
9

本文介绍了如何将情节提要中的多个按钮连接到单个动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我目前正在使用 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:

这篇关于如何将情节提要中的多个按钮连接到单个动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21

正确的 cocos2d 场景重启?
Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)...
2024-08-12 移动开发问题
7