在另一个NSArray中访问aNY Array的信息

时间:2014-02-17 20:44:12

标签: ios objective-c

我正在尝试将数据从集合视图控制器传递到表视图控制器。我想要的是当用户选择集合视图的项目然后它将项目的数据传递给表视图控制器,并且表视图控制器根据所选项目呈现项目的信息。但我不知道如何访问另一个NSArray内部的NSArray数据。

这是我在实现文件中声明的所有成员变量。

_arrayOfChaufa = @[@"qUESIto", @"Jodido", @"Ala", @"Que pajita", @"Wuauau", @"Tengo hambrunita", @"jojolete", @"Sequito duro", @"Latititititito", @"Manusico"];

_arrayOfLomo = @[@"Que novedada", @"jajajaja que buena", @"Lukita", @"losisisisi", @"maniserio", @"joder", @"joselet", @"lskadlkdl", @"bah"];

_arrayOfPapita = @[@"que buena!", @"csm!!", @"que genio!", @"novedades", @"que rico!!", @"coger delicisioso", @"Mffffff"];

_arrayOfParihuela = @[@"Un culaso", @"Chambon", @"Noveades", @"que hacer", @"asu macho", @"Espero que este bien", @"Así es la vida la chamba", @"Debo aprender mas!!"];

_arrayOfTacacho = @[@"Tacachin", @"Lalilinnn", @"Masinisn", @"Joder", @"Ojojoojojo", @"Lista hermosa!"];

_arrayOfAnticucho = @[@"Me encanta Objective-c", @"Hermosisimo", @"Me encanta xcode!", @"Que hermoso es esto", @"Debe ser un chambon total", @"jajajaja novedades", @"Lol supremo"];

_arrayOfCuy = @[@"Te me querías escapar ahhhhh jajajaj", @"Noveades de la vida", @"Jojojojojojo", @"Apple eres el MEJOR!!!"];

_arrayOfPachamanca = @[@"eL Ultimo array de la lista", @"Lo lograre carajo!", @"Esto es facil", @"Si se puede carajo", @"Mi primera aplicación!", @"Sobreviviree guerreros!!"];


 ***THIS IS THE NSARRAY THAT CONTAINS ALL THE NSARRAYS***
_arrayOfIngredients = @[@"_arrayOfCeviche, _arrayOfPachamanca, _arrayOfLomo, _arrayOfCuy, _arrayOfChaufa, _arrayOfAnticucho, _arrayOfParihuela, _arrayOfTacacho, _arrayOfPapita"];

我的问题在这里开始.....

- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"showDetail" sender:indexPath];
}

    // Method to pass data to another view
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

      if ([segue.identifier isEqualToString:@"showDetail"]) {

          NSIndexPath *indexPath = (NSIndexPath*)sender;

          DetailViewController *dvc = [segue destinationViewController];

           ***THIS PART IS MY PROBLEM PLEASE HELP ME***
          dvc.Titulos = [_arrayOfIngredients objectAtIndex:indexPath.row];
          }
     }

1 个答案:

答案 0 :(得分:4)

请勿在此处使用NSString:

_arrayOfIngredients = @[_arrayOfCeviche, _arrayOfPachamanca, _arrayOfLomo, _arrayOfCuy, _arrayOfChaufa, _arrayOfAnticucho, _arrayOfParihuela, _arrayOfTacacho, _arrayOfPapita];