Asi Givati Asi Givati - 2 months ago 73
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)

before:

now:

now:

Answer

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.