Before AutoLayout I could do a view cut to a circle shape with setting .layer.cornerRadius
to half of the view's height.
Now, using AutoLayout how can I achieve, to my view keep look like a circle?
I have already tried and failed:
frame
changes. It gets called, but at that point setting cornerRadius
on the view does not have any effect-setNeedsLayout
to have frame values before I set cornerRadius
(does not work either)You need to set the property masksToBounds
on the layer.
xyz.layer.masksToBounds = YES;
Further, the reason why this actually won't affect Auto Layout is because the view's frame will remain the same regardless of its corner radius.