PDA

View Full Version : Extract string from string-array?




Danneman101
May 10, 2009, 07:15 AM
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?



BlackWolf
May 10, 2009, 07:32 AM
have you ever tried the objC way?

NSString *letter = [buttonNamesSecondRow objectAtIndex:2];


see if that works. if it doesn't ... strange :D

Danneman101
May 10, 2009, 08:40 AM
Argh!!! Ill never get the hang of the obj-c syntax :/

Thanks for the input - works fine :)