How can i getting a value?

Discussion in 'iOS Programming' started by joak, Apr 1, 2014.

  1. joak macrumors newbie

    Joined:
    Mar 7, 2014
    #1
    Hello

    I have this array ...
    Code:
    {
        equipos = "Sportin VS Portugal";
        "hora_partido" = "11:00";
        "id_equipoL" = 12;
        "id_equipoV" = 5;
        "id_jornada" = 11;
        "id_juego" = 3;
        "id_torneo" = 10;
        "nom_torneo" = "Juvenil Sabatino";
    }
    
    How can I get the values por the key "EQUIPOS"?

    Regards
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Could you share the actual section of code that produces your "array" (it looks more like a dictionary to me).
     
  3. joak thread starter macrumors newbie

    Joined:
    Mar 7, 2014
    #3
    I pass the value to another UIViewController so in another UIViewControler I want to get this values

    Code:
     NSString *selectedCell = nil;
        NSDictionary *dictionary = [self.dataArray objectAtIndex:indexPath.section];
        NSArray *array = [dictionary objectForKey:@"data"];
        selectedCell = [array objectAtIndex:indexPath.row];
        NSLog(@"%@", [array objectAtIndex:indexPath.row]);
        
        
        JFGTablero *tablero = [self.storyboard instantiateViewControllerWithIdentifier:@"JFGTablero"];
        tablero.datosEncuentro =[array objectAtIndex:indexPath.row];
        [self.navigationController pushViewController:tablero animated:YES];
    
     
  4. Menneisyys2 macrumors 603

    Joined:
    Jun 7, 2011
    #4
    Just add a NSDictionary property to the pushed VC and set its value to your NSDictionary before the call to pushViewController. Then, you'll be able to access the dictionary during the entire lifetime (incl. viewDidLoad() etc.) of your sub-VC.

    If you don't know how this is done, please change the class/prop names to English so that I can have an easier time working with them and I'll answer with a full Xcode project showing this.
     
  5. joak thread starter macrumors newbie

    Joined:
    Mar 7, 2014

Share This Page