title: How to change the cornerRadius of button from storyboard with custom IBDesignable class created
body: <p>The class given below is working fine  </p>
  
  <pre><code>@IBDesignable class iButton : UIButton {
  
  @IBInspectable var cornerRadius : CGFloat = 0.0{
      didSet{
          layer.cornerRadius = cornerRadius
      }
  }}
  </code></pre>
  
  <p>But question is, when i set cornerRadius value 35 in Attribute Inspector for the button with size of (width : 70, Height 70). Im getting rounded button on the storyboard but while running it on Simulator its not circular instead its rounded rectangle. </p>
  
  <p>My Design View on xCode is iPhone-SE and simulated on iPhone-7-plus simulator.</p>
  
  <p>I have also enabled autoresize by setting the height and width on the Size Inspector.</p>
  
  <p><a href="https://i.stack.imgur.com/pTBZH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pTBZH.png" alt="Check this Image for xcode design and Simulated device Screen"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ZJWdo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZJWdo.png" alt="Size Inspector for Auto-Resizing"></a></p>
  
  <p>Out of my knowledge the corner radius should be the half of the width. And when the button is resized by auto-resizing why not the corner radius is resized. how can i fix this?</p>
  
  <p>Thanks in advance.</p>