简体   繁体   English

如何在数组中存储与图像关联的两个值?

[英]How can I store two values associated with an image in an array?

I'm trying to figure out a way I can store and associate a letter (az), a value (1-10), and an image with each other. 我试图找出一种方法来存储和关联字母(az),值(1-10)和图像。 For example, lets say that associate: 例如,假设该关联:

A with 2 with letterA.png
B with 1 with letterB.png

..etc ..等等

I'm thinking that I need some kind of array. 我在想我需要某种数组。 It would be nice if I could use the letters as the indexes. 如果可以将字母用作索引,那就太好了。

Perhaps a dictionary of dictionaries? 也许是字典词典? Your question is a bit vague to provide a perfect example, but something like this: 您的问题有点模棱两可,无法提供一个完美的例子,但类似这样:

associationDictionary = {
    "A" = {
        "number" = 2;
        "image" = "letterA.png";
    }
    "B" = {
        "number" = 1;
        "image" = "letterB.png";
    }
}

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

相关问题 如何使用Objective C在Realm DB中存储数组值(RLMArray)? - How can I store array values (RLMArray) in Realm DB with Objective C? 如何将UIButtons存储在数组中? - How can I store UIButtons in an array? 如何在Facebook iOS SDK上存储多个分数值 - How can I store multiple score values on Facebook iOS SDK 如何将SpaceManager cpShape存储在数组中? - How can I store SpaceManager cpShape's in something like an array? 如何将Google Maps搜索结果存储在数组中? - How can I store Google Maps search results in an array? 我如何将访问令牌存储为默认值或数组 - how can i store my access token to defaults or into an array 如何在Parse中存储自定义对象的数组? - How can I store an array of custom objects in Parse? 如何从两个Mutablearrays检索值并将它们存储在MutableDictionary中,并且键作为数组? - How to retrieve values from two Mutablearrays and store them in MutableDictionary with keys as an array? 如何在iPhone中的数组中存储NSDictionary值 - How to Store NSDictionary values in an array in iphone 如何将sqlite数据库值添加到数组中?我已检索到但如何将这些值放入数组中? - How to add sqlite database values into an array?I was retrived but how can I put these values into array?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM