The second image, as @Putz1103 said, is just a linear gradient with a mask.
But what you are trying to do (as the first image suggests) is an angle gradient, not a circular gradient.
Here is an image of the three gradients with the same colors: linear, radial, angle:
Unfortunately CoreGraphics doesn't provide a way to create an angle gradient. But you could fake it in another way, like drawing small shapes with different colors around a circle. Here is how: https://stackoverflow.com/a/12775798/942420