I am trying to make rounded corners for my views and fencing a strange problem.
I use the following code to make rounded corners for my view
bezierPath = [UIBezierPath bezierPathWithRoundedRect:btnView.bounds
byRoundingCorners:UIRectCornerAllCorners
cornerRadii:radius];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = btnView.bounds;
maskLayer.path = bezierPath.CGPath;
btnView.layer.mask = maskLayer;
The problem is, it is not working for bottom corners. If I use UIRectCornerBottomLeft
nothing happens, if I use UIRectCornerAllCorners
only top corners are rounded.
EDIT: I dont use layer.cornerRadius because I just want to round bottom corners.
It turned out I do not have problem, if I remove UIViewAutoresizingFlexibleHeight
autoresizing mask from my view. But I would like to use autoresizing mask. Is it possible if yes how?
I have already tried setting autoresizingMask before and after setting the mask of the layer. No luck!
Until I get an another answer, if it is possible to use autoresizingMask with UIBezierPath
, I say NO and mark as correct answer.
I do not delete my question, because anybody can fence the same problem without knowing the reason.