我正在学习 iphone 应用程序开发,并正在研究允许您输入两个单词并将它们组合起来的东西。这两个词和组合词被输入到字典中,然后存储在可变数组中。还有另一个选项允许您输入整个单词,如果它在数组中,它将返回组成它的两个单独的单词。我的问题是我不知道如何搜索数组并遍历每个对象并整理出答案。例如:
(
{
"Combined Word" = snowman;
"Word 1" = snow;
"Word 2" = man;
},
{
"Combined Word" = dirtbike;
"Word 1" = dirt;
"Word 2" = bike;
},
{
"Combined Word" = schoolbus;
"Word 1" = school;
"Word 2" = bus;
},
{
"Combined Word" = raindrop;
"Word 1" = rain;
"Word 2" = drop;
}
如果我进入schoolbus并按下按钮,我如何编码以便搜索可变数组并分析每个对象的“组合字”,以便输入的字是一个值,它将返回相应的“字1”和“词 2"。