我在app appate中创建了一个数组。我希望数组名称的一部分是可变的。我试过componentsSeparatedByString:
。
我的最终代码有效:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
testAnimation.animationImages = appDelegate.A_SL1_Deal;
我希望“A_SL1”可变。我试过这个:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *app_del = @"appDelegate.";
testAnimation.animationImages = [app_del componentsSeparatedByString: @"A_SL1_Deal"];
我还尝试将所有内容转换为字符串:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
testAnimation.animationImages = [NSString stringWithFormat:@"appDelegate.%@_Deal", display_string];