Comment added as answer:
The only way of creating an array that way is dynamically in code. If you are adding to an iVar (class variable) you need to go through one by one because the memory has already been allocated at initialization. So use startAndEndColors[0] = ...
, etc.
As for your follow up question: No, there is no way to assign values in that way to memory that has already been initialized in the allocation phase. If you used std::vector or other objects then it would be possible.
A way around that would be something like this in your header
CGFloat *startAndEndColors;
And then something like this in your implementation
float colorsTest[8] = {red, green, blue, alpha, red1, green1, blue1, alpha1};
startAndEndColors = colorsTest;
That way you can initialize it the way you want to, but you have no guarantee of the number of objects in your startAndEndColors
object. You could later assign it to something of the wrong size and cause crashes if you try to access outside of it's bounds.