I create an array in my app delegate. I want part of the array name to be variable. I have tried componentsSeparatedByString:
.
My final code that works:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
testAnimation.animationImages = appDelegate.A_SL1_Deal;
I want the “A_SL1” to be variable. I tried this:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *app_del = @"appDelegate.";
testAnimation.animationImages = [app_del componentsSeparatedByString: @"A_SL1_Deal"];
I also tried just converting everything to a string:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
testAnimation.animationImages = [NSString stringWithFormat:@"appDelegate.%@_Deal", display_string];