Я бы предложил создать массив и словарь: один для хранения всех ваших файловых путей и один для хранения ваших массивов.
Создайте массив filepaths со всеми именами файлов, из которых вы хотите загрузить данные.
Словарь arrayStructures изначально должен быть пустым NSMutableDictionary
емкостью 25 (буквы в алфавите -1 (без х)).
Переберите массив filepaths и сделайте то, что вы делали для каждой итерации, за исключением того, что в конце каждой итерации вы должны вызывать addObject: forKey:
dictionaryStructures dictionary.
NSMutableDictionary *structures = [ [ NSMutableDictionary alloc ] initWithCapacity:25 ];
NSArray *filePaths = [ [NSArray alloc] initWithObjects: @"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", /* no X */@"Y", @"Z" ]; // you could also just create a standalone text file and load it from there, i know this is ridiculous!
for( NSString *path in filePaths ) {
NSString *filePath = [[NSBundle mainBundle] pathForResource:path ofType:@"txt"];
NSString *myText = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[ structures addObject: [myText componentsSeparatedByString:@"-"] forKey: path ];
}
Теперь переберите словарь ....
for( NSString *filePath in structures ) {
NSArray *structure = [ structure objectForKey: filePath ];
//...
}