The class given below is working fine
@IBDesignable class iButton : UIButton {
@IBInspectable var cornerRadius : CGFloat = 0.0{
didSet{
layer.cornerRadius = cornerRadius
}
}}
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.
My Design View on xCode is iPhone-SE and simulated on iPhone-7-plus simulator.
I have also enabled autoresize by setting the height and width on the Size Inspector.
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?
Thanks in advance.