This is a basic example that I know can be simplified, but for testing sake, I would like to do this in such a way. I want to set a variable based on an appending string (th
One way you can do this would be to create your cameras in a dictionary and use those special NSStrings to key in to it. Like,
NSMutableDictionary *myCams;
myCams = [[myCams alloc] init];
[myCams addObject:YOUR_CAM0_OBJECT_HERE forKey:@"cam[0]"];
[myCams addObject:YOUR_CAM1_OBJECT_HERE forKey:@"cam[1]"];
NSString camString = @"cam[0]"; // you'd build your string here like you do now
id theCamYouWant = [myCams objectForKey:camString];