NSDictionary *item = [NSDictionary dictionaryWithObjectsAndKeys:
eyeNameHolder,@"eye",
lipsNameHolder,@"lips",nil];
NSMutableArray *arrayItems = [NSMutableArray arrayWithObject:item];
[arrayItems insertObject:item atIndex:dynamical variable];
[arrayItems writeToFile:finalPath atomically:YES];
如何通过点击0到10之间的不同按钮从0到10发送不同的值来动态替换atIndex的值?
答案 0 :(得分:3)
NSMutableArray
有replaceObjectsAtIndex:withObject:
,尝试类似:
[arrayItems replaceObjectsAtIndex:atIndex withObject:/*0-10*/];
答案 1 :(得分:0)
我做了类似下面的事情,它运作正常。
AppDelegate* ref = (AppDelegate*) [[UIApplication sharedApplication] delegate];
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithObjectsAndKeys:
eyeNameHolder,@"eye",
lipsNameHolder,@"lips",nil];
[arrayItems replaceObjectAtIndex:ref.IndexerHolder withObject:item];
[arrayItems writeToFile:finalPath atomically:YES];