I would like to be able to create an array with e.g 4 colors. And then use them in my tableview cells, inside cellForRowAtIndexPath. Like this:
-----------------
| red |
-----------------
-----------------
| blue |
-----------------
-----------------
| yellow |
-----------------
-----------------
| green |
-----------------
-----------------
| red |
-----------------
-----------------
| blue |
-----------------
-----------------
| yellow |
-----------------
-----------------
| green |
-----------------
And so on. I was able to do this with modulus in javascript, but in xcode/obj c I just can’t figure it out. I looked everywhere. I managed to change every second, or just total random colors.
you may do the following:
this way each you will get the colors repeated each four rows,
I hope this helps, good luck!