NSMutableArray *tmpMutArr = [NSMutableArray arrayWithArray:allObjectsArray];
NSLog(@"The content of array is%@",tmpMutArr);
int index;
for (int i=0;i<[tmpMutArr count];i++)
{
if([[tmpMutArr objectAtIndex:i] isKindOfClass:[NSDictionary class]])
{
NSMutableDictionary *tempDict = [tmpMutArr objectAtIndex:i];
if([[tempDict valueForKey:@"Name"] isEqualToString:[NSString stringWithFormat:@"%@", nameString]])
{
index = i;
}
}
}
[tmpMutArr replaceObjectAtIndex:index withObject:[NSDictionary dictionaryWithDictionary:mutDict]];
此代码不能替换tmpMutArr的匹配对象的正确的索引,因为我希望它,但在tmpMutArr,而不是取代所有对象。如何只替换我想要的索引?获取字典
我知道,包含替换之前的所有对象tmpMutArr,所以我只需要指定正确,我认为指数。如何做?
你的意图确实是未知的。请在你的询问 – tGilani 2012-08-14 18:22:00
答固定我的问题更全面。 – ingenspor 2012-08-14 18:22:33