0
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];

Hello im very new to xcode and in fact to programming in general, i've been trying for quite a while to add an object to a specific part of the array (thats why i cant used componentsJoinedByString) but i've had a lot of trouble doing so, the way i'd normally do can anyone tell me what i've been doing wrong? And if i can't add objects to a specific part of an array can anyone possibly give me a suggestion of what i should try? thanks.

1 Answer 1

2

You can add an object to a specific part of an array like so:

[array insertObject:@"Hello" atIndex:1]; // After first object in array
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, array's start at "0" (zero) so inserting at index "1" would insert an object after the first object. (just wanted to clarify why Brayden used "1" as opposed to "2" since you mentioned you were new to programming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.