As in my comment above, I am a little foggy why this works. It seems that after several tests on iOS6 I have 2 sublayers, where for iOS7 I have 1. That this is due to the introduction of indexes outside of me. I don't understand why setting the gradient to index 1 works ... doh! :)
But for my needs, I required a gradient to appear above everything else, so instead of using the answer above with OS checks (which BTW works fine !!), I did something like:
[self.layer insertSublayer:_gradientLayer above:[self.layer.sublayers firstObject]]
source share