I need to round specific corner of my image view and uiview Imgview Top left and Top right View Bottom left and Bottom right.
and I explore and find this method
[self setMaskTo:_viewBookNow byRoundingCorners:UIRectCornerBottomLeft];
[self setMaskTo:_viewBookNow byRoundingCorners:UIRectCornerBottomRight|UIRectCornerBottomRight];
[self setMaskTo:_imgVAnimal byRoundingCorners:UIRectCornerTopRight];
[self setMaskTo:_imgVAnimal byRoundingCorners:UIRectCornerTopLeft];
Method definition is this
- (void)setMaskTo:(UIView*)view byRoundingCorners:(UIRectCorner)corners
{
UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds
byRoundingCorners:corners
cornerRadii:CGSizeMake(8.0, 8.0)];
CAShapeLayer *shape = [[CAShapeLayer alloc] init];
[shape setPath:rounded.CGPath];
view.layer.mask = shape;
}
but it only round left corners of view and image not work for right corners.
Please suggest
Thanks
clipsToBounds = true
&maskstobounds = true
and try – dahiya_boyview.layer.masktobounds = true
Its a layer property. – dahiya_boy