Note that there are some explanatory texts on larger screens.

plurals
  1. POButton background and gradient change since iOS6
    text
    copied!<p>For an app I had to create a <code>UIButton</code> filled with a gradient and a background image. Everything worked fine until I upgraded the OS from iOS 5.1 to the recently released iOS 6. </p> <p>Here are two screenshots from the simulator : </p> <p><img src="https://i.stack.imgur.com/QyGHF.png" alt="screenshot with iOS 5.1"></p> <p><img src="https://i.stack.imgur.com/Zp3Xa.png" alt="Screnshot with iO 6"></p> <p>Well, the first screenshot shows what I need (and did), you can see a brown background and the grey radient. </p> <p>Below is the screenshot with the same buttons but with iOS 6 running. As you can see the gradient has vanished and a strange white strip has appeared at the bottom of the <code>UIButton</code>.</p> <p>I've looked if this is a bug or something but I've found nothing, maybe someone here has faced the same problem? Here is my code for gradient</p> <pre><code>CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = btnCountry.bounds; UIColor *colorTop = [UIColor colorWithRed:.992f green:.992f blue:.992f alpha:1]; UIColor *colorBot = [UIColor colorWithRed:.788f green:.769f blue:.745f alpha:1]; gradient.colors = [NSArray arrayWithObjects:(id)[colorTop CGColor], (id)[colorBot CGColor], nil]; gradient.borderColor = [UIColor colorWithRed:.545f green:.506f blue:.459f alpha:1].CGColor; gradient.borderWidth = 1; gradient.masksToBounds = YES; gradient.cornerRadius = 11; [[btnCountry layer] insertSublayer:gradient atIndex:0]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload