Ios 如何在nsmutablearray中使用数据?
此数据位于Ios 如何在nsmutablearray中使用数据?,ios,objective-c,json,ios7,nsmutablearray,Ios,Objective C,Json,Ios7,Nsmutablearray,此数据位于NSMutableArray中,我通过id或title获取此数据,当时我仅获取title abc如何获取NSMutableArray中的所有数据 我的代码是:- ( ( { "id" = 4; "title" = abc }, { "id" = 5; "title" = xyz; }, { "id" = 7;
NSMutableArray
中,我通过id或title获取此数据,当时我仅获取title abc如何获取NSMutableArray中的所有数据
我的代码是:-
(
(
{
"id" = 4;
"title" = abc
},
{
"id" = 5;
"title" = xyz;
},
{
"id" = 7;
"title" = "pqr";
}
)
)
for(int计数器=0;计数器<[tempData count];计数器++)
{
NSMUTABLEARRY*tempData1=[tempdataobjectatindex:counter];
NSString*str_title=[tempData1 objectAtIndex:counter][@“title”];
[nsm_临时添加对象:str_title];
}
nsm_temp
是NSMutableArray
假设tempData
是您可以执行的外部数组:
for(int counter =0 ; counter < [tempData count];counter++)
{
NSMutableArray *tempData1 = [tempData objectAtIndex:counter];
NSString *str_title = [tempData1 objectAtIndex:counter][@"title"];
[nsm_temp addObject:str_title];
}
您有一个包含字典数组的数组;而是tempData[0];
NSArray *tempData = ... // the outer array
NSArray *innerArray = tempData[0];
for (NSDictionary *dict in innerArray) {
NSString *title = dict[@"title"];
[nsm_temp addObject:title];
}