Asi Givati Asi Givati - 1 year ago 198
iOS Question

Xcode 8 - Some buttons layer border removed

I just updated my Xcode ver from 7.3 to 8.0 and some buttons borders disappeared.

The code looks fine, so I really don't know what happened to the layers.
btw - in some other controllers I can see the layers borders.

self.button.layer.borderColor = borderColor.CGColor;
self.button.layer.borderWidth = 2;
self.button.layer.cornerRadius = CGRectGetHeight(self.button.frame) / 2;

before: (The image is only for example - the borders looks different at real time)




Answer Source

I think problem in it:

CGRectGetHeight(self.button.frame) / 2;

When you set corner i think height button don't have value or value to larger border will don't show. You can try change it to

self.button.layer.cornerRadius = 15;

If work, I think you can check your logic and set it when height button get right value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download