Is there a way to use the contents of an NSString as the NSArray pointer name? It’s possible that this is not available, but maybe there is another method to something like this:
NSString*one=@"hi";
NSString*two=@"yo";
NSArray*testarray=[[NSArray alloc] initWithObjects:one, two, nil];
NSLog(@"actual count: %i", [testarray count]);
NSString*testname=@"testarray";
NSLog(@"test count: %i",[ --insert here to get array name from testname-- count]);
I’ve tried a variety of guesses for what I could insert in there to use my testname as the array name for the count operation, but no dice. I know it’s a bit odd, but I can foresee quite a lot of useful reasons to do this, and I’m having one right now in another app.
1 Answer