1

因此,我现在拥有的表格包含多个单元格。每个单元格有两个 UIlabels。表格下方是一堆具有不同 int 值的按钮。我想让用户点击标签,然后点击按钮将标签的文本更改为他们按下的任何按钮。例如,如果他们按下按钮,“1”、“2”、“3”,标签将显示 6。

我想我设法弄清楚如何找出被触摸的标签,但后来我被卡住了,因为我不知道如何让按钮按下部分工作。有任何想法吗?提前致谢!

4

1 回答 1

0

To know which UILabel has been touched add a tap gesture to each label which triggers an action. In that actions store which label has been touched in e.g. a property. For the buttons, just connect them to action methods (could also be a single one), inside these methods do your calculation and updated the label indicated by the property described above.

于 2013-07-02T16:51:31.717 回答