I have four integer values: 1, 2, 3 and 4.
Instead of printing the int values, I have to transform to a corresponding text.
1 -> my text 1
2 -> another text
3 -> yet another one
4 -> text 4
Also I have to change the color:
1 -> gray
2 -> black
3 -> blue
4 -> green
So I did this:
NSArray *myArray = [NSArray arrayWithObjects:@"",@"my text 1",@"another text", @"yet another one", @"text 4", nil];
myTextLabel.text = [myArray objectAtIndex:myInt];
But how to get the color code? Normally I do this:
myTextLabel.textColor = [UIColor greenColor];
But how can I do this with my list? And also, what is the best way to to the transformation of an integer value to a text and a text color code? Perhaps there is a better way?
Thank you in advance & Best Refards.
The same way :
For the index 0, you can’t use nil, so put a color that you know you won’t use.