I have values i wanted to load dynamically in an array, here are the examples
First of all i define 3 different values in my init, and then in my array i want it to determine which value to read. Example: First i define the value
int value1=20
int value2=40;
int value3=60;
i then define another int in my array called valueToLoad, and i'll give each of them a number tag. and i want the individual array item to read different value based on their number tag so that Item 1 will read value1, Item 2 will read value2 and so on. i tried the method below to convert NSString into int:
NSString *valueVariable=[NSString stringWithFormat:@"value%d",i]; (i being the number tag)
int valueToRead = [valueVariable intValue];
unfortunately, this conversion doesn't supports conversion of any other thing except if the string is actual integer. However i do not want to run the IF statement to do:
if(tag==1)
{ int valueToLoad= value1;}
For who don't understand. I am just trying to read different Int value in an array based on the number of array. Let's assume i have 3 Items in array naming A,B,and C. i want Item A to read Value 1, ItemB to read Value2 and so on.