将对象添加到NSArray

时间:2012-08-24 21:00:08

标签: xcode nsarray

NSString* title = [rescue objectForKey:@"title"];
NSString* name = [rescue objectForKey:@"name"];


NSMutableArray* listBossF = [[NSMutableArray alloc] initWithObjects:@"Hello %@ %@  I've just arrived"[title, name] ,
                                   @"Hello  %@ %@everything is fine",
                                   @"Hello  %@ %@ are there any news back at the office?",
                                   @"Hello ( %@ %@ i arrived at the hotel" ,
                                   @"Hello %@ %@ I've just arrived at the airport", nil];

你好我是非常新的xcode,事实上对于编程一般来说,我已经尝试了很长一段时间将一个对象添加到数组的特定部分(这就是为什么我不能使用componentsJoinedByString)但我已经有了这样做很麻烦,我通常做的方式可以告诉我我做错了什么吗?如果我不能将对象添加到数组的特定部分,任何人都可以给我一个我应该尝试的建议吗?感谢。

1 个答案:

答案 0 :(得分:2)

您可以将对象添加到数组的特定部分,如下所示:

[array insertObject:@"Hello" atIndex:1]; // After first object in array