循环遍历 NSDictionary 中的条目
我正在编写一个有两组按钮的游戏。第一组就像空格,第二组是自定义键盘。
因此,我创建了一个字典来跟踪界面中选定的按钮(空白)。用户可以选择其中 5 个并立即更新其所有标题。当用户按下一个键(在我的自定义键盘上,由单独子视图中的按钮组成)时,我想更改所有标题以显示按下的键上的字母。
我的钥匙编号(按字母数字顺序)从 1 到 26(即 a=1,z=26),并且空白处的当前标签集将以类似的数字形式保存在名为“currentSolution”的数组中,
我想我可以设置一个 for 循环来遍历选定的空白,并为它们提供在 keyPressed 方法中选择的任何键的所有标题。有人可以在这里给我任何指导吗?我有点菜鸟,真的不知道该怎么做,
谢谢
Im writing a game that has two sets of buttons. The first set is like blank spaces, and the second set is a custom keyboard.
So I've created a dictionary to keep track of selected buttons (blank spaces) in my interface. The user can select say 5 of these and update all of their titles at once. When the user presses a key (on my custom keyboard made of buttons in a separate subview) I want to change all of the titles to show the letter on the key the pressed.
I have my keys numbered (alphanumerically) from 1 to 26 (ie. a=1, z=26) and the current set of labels on the blanks will be kept in similar numeric form in an array called "currentSolution"
Im imagining i can set up a for loop to go through selected blanks and give them all the title of whatever key is selected in the keyPressed method. Can anyone give me any guidance here? im kinda a noob and dont really know how i should go about this
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用(仅在ios 4中)-
希望它会有所帮助
You can use (only in ios 4)-
Hope it will help