简体   繁体   English

如何让我的iOS应用识别按钮在哪行/列中?

[英]How can I have my iOS app recognize which row/column a button is in?

So I have 4 rows and 4 columns and each row and column contains 4 buttons 所以我有4行4列,每行和每列包含4个按钮

OOOO OOOO

OOOO OOOO

OOOO OOOO

OOOO OOOO

So when I click on the first O. I want xcode to recognize that it is in row1 and column 1. 因此,当我单击第一个O时,我希望xcode能够识别它在row1和column 1中。

I have already declared everything as buttons, ints,etc. 我已经将所有内容声明为按钮,整数等。 But I need help defining rows/columns and placing these buttons in that row/column. 但是我需要定义行/列并将这些按钮放在该行/列中的帮助。

I am going to assume that these buttons are created using storyboard and that each one has a unique name. 我将假定这些按钮是使用情节提要创建的,并且每个按钮都有唯一的名称。 Provided all of this, you can create a 2-dimensional array adding each of these buttons to the appropriate spot in the array. 提供所有这些,您可以创建一个二维数组,将每个按钮添加到数组中的适当位置。

ex. 例如 array[0][0] = button0

This, while tedious, will solve this problem for your 16 button problem. 这虽然很乏味,但可以解决您的16按钮问题。

暂无
暂无

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

相关问题 如何在我的应用程序中的iOS键盘上使用@和.com - How can I have the @ and the .com on ios keyboard in my app 如何在iOS应用中识别图像中的手写数字? - How can I recognize handwritten numbers within an image in an iOS app? 我可以在 iOS 应用中添加“在 homekit 应用中打开”按钮吗? - Can I add a "Open in homekit app" button to my iOS app? 如何从我的应用程序中删除新的回到以前的应用程序iOS 9按钮? - How can I remove the new back-to-previous-app iOS 9 button from my app? 我该如何解决我希望提交到应用商店的iOS项目中的错误? - How can I address errors in my iOS project which I hope to submit to app store? 当我按下按钮推送到另一个ViewController时,如何知道哪个indexPath.row我的按钮? - How can I know which indexPath.row my button in when I press a button to push to another ViewController? 如何识别ios中的键盘按键? - How can I recognize keyboard presses in ios? 由于我的 flutter 应用程序中有两个主要文件,我该如何选择要从 xcode IOS 存档的程序? - how do i choose which program to archive from xcode IOS as i have two main files in my flutter app? 如何了解我的iOS应用正在运行哪些设备/操作系统版本? - How can I learn which devices/OS versions my iOS app is being run on? 人们如何使用我自己创建的IOS应用程序? 我的苹果没有付费帐户 - How can people use my own created IOS app? I have no paid account in apple
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM