Extract string from string-array?

Discussion in 'iOS Programming' started by Danneman101, May 10, 2009.

  1. Danneman101 macrumors 6502

    Aug 14, 2008
    Im trying to extract a NSString from a NSArray that is populated with strings, but keep getting "incompatible types in initialization".

    NSArray *buttonNamesSecondRow = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E", nil];	
    NSString *letter = buttonNamesSecondRow[2]; // Trying to get the "C"
    I must be missing some kind of type-cast, but I cant find the syntax for doing this correctly. Any ideas?
  2. BlackWolf macrumors regular

    Apr 9, 2009
    have you ever tried the objC way?
    NSString *letter = [buttonNamesSecondRow objectAtIndex:2];
    see if that works. if it doesn't ... strange :D
  3. Danneman101 thread starter macrumors 6502

    Aug 14, 2008
    Argh!!! Ill never get the hang of the obj-c syntax :/

    Thanks for the input - works fine :)

Share This Page