我有一个包含字典对象的数组.在每个字典中,密钥是常见的.现在我想获得该密钥的所有值.我有迭代的这些值,但我正在寻找一些直接的方法或一个默认的方法来完成这项工作.
你能帮我一个默认的方法来达到目的吗?谢谢.
数据结构是这样的:
<array>
<dict>
<key>Match</key>
<string>Football</string>
<key>Stadium</key>
<string>XXXXX</string>
</dict>
<dict>
<key>Match</key>
<string>HOCKY</string>
<key>Stadium</key>
<string>XXXXX</string>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
我现在这样做:
NSMutableArray * matches = [[NSMutableArray alloc] init];
for (int i = 0; i< myArray.count; i++){
[matches insertObject:[[myArray objectAtIndex:i] objectForKey:@"Match"] atIndex:i];
}
[matchDataArray addObjectsFromArray:matches];
Run Code Online (Sandbox Code Playgroud)
它给了我正确的答案.但我不想做这个迭代.我想要一个方法,它将从数组的所有索引返回"匹配"键的所有值,并立即保存在另一个数组中.新创建的数组将只包含来自数组的所有索引的Match键值.
这可能吗??
我是java的新手.我正在从excel创建pList.我的Excel文件包含多个工作表.我想迭代excel文件的所有表格.怎么样?请帮忙.
我有一个NSArray,其中包含一些重复的对象.我想打印哪些对象正在重复,例如:
NSArray * array = [NSArray arrayWithObjects: A, B, C, A, B];
Run Code Online (Sandbox Code Playgroud)
现在,我想在我的控制台打印A
和B
这些被复制.
我该怎么做呢?
我想为像弹跳的图像制作动画.我能够将它向前弹回但我无法将其推回去.我正在使用此代码:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0f];
hair.transform = CGAffineTransformMakeScale(3.0, 3.0);
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
请帮帮我..我现在是结构而且无法解决这个问题.请帮帮我.
可能重复:
如何用零填充左侧的整数?
在我的iPhone应用程序中,我正在以这种方式计算时间.
int timeTakeInSeconds = (int)(self.timeTaken*[constants timer]);
int timeTakenMins= (int)(timeTakeInSeconds/60);
int timeTakenSecs =(int)(timeTakeInSeconds%60);
NSString *timeText = [NSString stringWithFormat:@"Time %d:%d",timeTakenMins,timeTakenSecs];
Run Code Online (Sandbox Code Playgroud)
通过这个我得到第二,1,2,... 10,11 ......等等.但我需要01,02,03 ...... 10,11,12 ......等等......我怎么能这样做?数字格式化器有没有办法做到这一点?请帮忙.
iphone ×5
ios ×3
objective-c ×3
nsarray ×2
apache-poi ×1
arrays ×1
cocoa-touch ×1
excel ×1
java ×1
loops ×1
nsdictionary ×1
timer ×1
uilabel ×1
uislider ×1
xcode ×1