I use next code:
- (void)setMaskByRoundingCorners:(UIRectCorner)corners withCornerRadius:(float)radius
{
UIBezierPath* rounded = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer* shape = [[CAShapeLayer alloc] init];
[shape setPath:rounded.CGPath];
shape.frame = self.bounds;
self.layer.mask = shape;
}
But now I see this strange effect.
I call it from viewcontroller, after didlayoutsubviews. I do that for main thread updating.
- (void)viewDidLayoutSubviews
{
[self initUIfeatures];
}
- (void)initUIfeatures
{
[authTextField setMaskByRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight|UIRectCornerBottomLeft) withCornerRadius:8.0f];
}
The issue is rounded corners getting cutoff.