title: UIButton: why are rounded corners visible?
body: <p>I have a UIButton whose type is set to 'custom' in IB. In code, the button is formatted like so:</p>
  
  <pre><code>self.btnScan.layer.borderColor = [[UIColor blackColor] CGColor];
  self.btnScan.layer.borderWidth = 1.0f;
  self.btnScan.layer.backgroundColor = [[UIColor whiteColor] CGColor];
  self.btnScan.layer.cornerRadius = 0.0f;
  </code></pre>
  
  <p>In the IOS-Simulator it is displayed correctly, but when I test on the device (iPad 2), there are light grey rounded corners in addition to the actual black non-rounded border. 
  See pictures:</p>
  
  <p>original size: <img src="https://i.stack.imgur.com/hZZ8h.png" alt="corners"></p>
  
  <p>enlarged size: <img src="https://i.stack.imgur.com/GCNJ3.png" alt="corners enlarged"></p>
  
  <p>I also tried</p>
  
  <pre><code>[self.btnScan.layer setMasksToBounds:YES];
  </code></pre>
  
  <p>without success.</p>
  
  <p>How can I eliminate those grey rounded corners? Any help would be appreciated.</p>
  
  <p>Edit: What could be the reason for this error only appearing on the device and not in simulator. I also tried xCode clean and re-installing the app.</p>