Hi
I have a bunch of NSStrings in a NSMutableArray. I have added them to the array and now I want to loop through the array, getting each object in it (the strings) and set them to a common value @"No Lessons".
This is how I have the loop so far: But how can I get the object then set it? Currently its fairly simple, just getting looping through the array, not changing anything.
NSInteger *count = [monLessonArrayA count];
for (int i = 0; i < count; i++) {
[monLessonArrayA objectAtIndex:i];
}
Any help much appreciated, thanks.
EDIT:
Turns out there is a larger issue somewhere. This is the code I am using:
NSMutableArray* lessonArrayFuncTwo(id a, id b, id c, id d, id e, id f) {
NSMutableArray* lessonsArray = [[NSMutableArray alloc] init];
[lessonsArray addObject:a];
[lessonsArray addObject:b];
[lessonsArray addObject:c];
[lessonsArray addObject:d];
[lessonsArray addObject:e];
[lessonsArray addObject:f];
return lessonsArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
monLessonArrayA = lessonArrayFuncTwo(monP1A, monP2A, monP3A, monP4A, monP5A, monP6A);
monLessonArrayB = lessonArrayFuncTwo(monP1B, monP2B, monP3B, monP4B, monP5B, monP6B);
tueLessonArrayA = lessonArrayFuncTwo(tueP1A, tueP2A, tueP3A, tueP4A, tueP5A, tueP6A);
tueLessonArrayB = lessonArrayFuncTwo(tueP1B, tueP2B, tueP3B, tueP4B, tueP5B, tueP6B);
wedLessonArrayA = lessonArrayFuncTwo(wedP1A, wedP2A, wedP3A, wedP4A, wedP5A, wedP6A);
wedLessonArrayB = lessonArrayFuncTwo(wedP1B, wedP2B, wedP3B, wedP4B, wedP5B, wedP6B);
thuLessonArrayA = lessonArrayFuncTwo(thuP1A, thuP2A, thuP3A, monP4A, thuP5A, thuP6A);
thuLessonArrayB = lessonArrayFuncTwo(thuP1B, thuP2B, thuP3B, thuP4B, thuP5B, thuP6B);
friLessonArrayA = lessonArrayFuncTwo(friP1A, friP2A, friP3A, friP4A, friP5A, friP6A);
friLessonArrayB = lessonArrayFuncTwo(friP1B, friP2B, friP3B, friP4B, friP5B, friP6B);
NSInteger count = [monLessonArrayA count];
for (int i = 0; i < count; i++) {
[monLessonArrayA replaceObjectAtIndex:i withObject:@"test"];
}
}
So now here I am using a function to simply put the strings into several arrays, then it comes back tot he loop, where it loops through the arrays and puts the text into the objects. Can you see any issues?
Upon loading the app crashes giving a SIGBRT error.