title: How to resize buttons with gradient background?
body: <p>I have some problems with button background when try to resize it, I use autoresize and 5.5 inch iPhone screen in interface builder. On iPhone 6plus and 6s plus buttons looks great like in interface builder but in 6 and 5s i see that buttons background width on 4 and 4.7 inch screen equal button background in interface builder. But when i press button it redraw and looks correct as i want(second screenshot). Here is screenshots. How can i fix it? </p>
  
  <p><a href="https://i.stack.imgur.com/He8AQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/He8AQ.png" alt="first screenshot"></a> <a href="https://i.stack.imgur.com/a98IA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a98IA.png" alt="enter image description here"></a></p>
  
  <p>Here is my code which locate in viewDidLoad </p>
  
  <pre><code>//** Gradient for red buttons **\\
  
      colorsForRedButtonGradient = [NSArray arrayWithObjects:
                                    (id)[UIColor colorWithRed:139.0/255.0 green:2.0/255.0 blue:2.0/255.0 alpha:1.0].CGColor,
                                    (id)[UIColor colorWithRed:155.0/255.0 green:21.0/255.0 blue:21.0/255.0 alpha:1.0].CGColor,
                                    nil];
      highlightedColorsForRedButtonGradient = [NSArray arrayWithObjects:
                                               (id)[UIColor colorWithRed:139.0/255.0 green:2.0/255.0 blue:2.0/255.0 alpha:0.5].CGColor,
                                               (id)[UIColor colorWithRed:155.0/255.0 green:21.0/255.0 blue:21.0/255.0 alpha:1.0].CGColor,
                                               nil];
  
      NSArray *locationForRedButtonGradient = [NSArray arrayWithObjects:
                                               [NSNumber numberWithFloat:0.0f],
                                               [NSNumber numberWithFloat:1.0f],
                                               nil];
  
      gradientLayerForSoundButton = [CAGradientLayer layer];
      gradientLayerForPopupButton = [CAGradientLayer layer];
      gradientLayerForVibroButton = [CAGradientLayer layer];
  
      gradientLayerForVibroButton.frame = _vibroButton.layer.bounds;
      gradientLayerForSoundButton.frame = _soundButton.layer.bounds;
      gradientLayerForPopupButton.frame = _popupButton.layer.bounds;
  
      gradientLayerForVibroButton.colors = colorsForRedButtonGradient;
      gradientLayerForVibroButton.locations = locationForRedButtonGradient;
      gradientLayerForSoundButton.colors = colorsForRedButtonGradient;
      gradientLayerForSoundButton.locations = locationForRedButtonGradient;
      gradientLayerForPopupButton.colors = colorsForRedButtonGradient;
      gradientLayerForPopupButton.locations = locationForRedButtonGradient;
  
      gradientLayerForVibroButton.cornerRadius = _vibroButton.layer.cornerRadius;
      [_vibroButton.layer insertSublayer:gradientLayerForVibroButton atIndex:0];
      gradientLayerForSoundButton.cornerRadius = _soundButton.layer.cornerRadius;
      [_soundButton.layer insertSublayer:gradientLayerForSoundButton atIndex:0];
      gradientLayerForPopupButton.cornerRadius = _popupButton.layer.cornerRadius;
      [_popupButton.layer insertSublayer:gradientLayerForPopupButton atIndex:0];
  </code></pre>