简体   繁体   English

图像角半径仅左下角

[英]image corner radius only bottom left and right

I want to corner radius exact in round shape only bottom corner left and right. 我想要圆角半径精确的圆形只左下角。 I already done it but bottom shape not look like exact round so how can I solve this problem 我已经完成了它,但是底部形状看起来不像精确的圆形,所以我该如何解决这个问题

在此输入图像描述

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.imageView.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.imageView.bounds;
maskLayer.path  = maskPath.CGPath;
self.imageView.layer.mask = maskLayer;

I have the same issues and I solved it like this : 我有同样的问题,我这样解决了:

- (void)setMaskTo:(UIView*)view {
CAShapeLayer *rect = [[CAShapeLayer alloc] init];
[rect setFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height/2)];
rect.backgroundColor = ([UIColor grayColor]).CGColor;

UIBezierPath *shape = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,rect.frame.size.height/2,self.view.frame.size.width,self.view.frame.size.height/2)];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = shape.CGPath;
shapeLayer.fillColor = [UIColor grayColor].CGColor;

CAShapeLayer *viewMask = [[CAShapeLayer alloc] init];
[viewMask addSublayer:shapeLayer];
[viewMask addSublayer:rect];

view.layer.mask = viewMask;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UITableviewCell底部左右角半径 - UITableviewCell Bottom Left & Right corner radius 拐角半径仅适用于视图的左上角和左下角 - Corner radius only for top and bottom left corner of a view 如何在 UIView 中为左上角和右上角的圆角半径仅设置顶部、左侧和右侧的边框? - how to set boarder for only top, left and right with corner radius with top-left and top-right in UIView? 为什么自定义视图的角半径仅应用于左上角和右上角? - Why is corner radius applied only to top left and right corner for a custom view? 如何仅创建具有左上角和左下角半径的圆角UIButton - How to create rounded UIButton with top-left & bottom-left corner radius only 如何为 UIView 的左下角、右下角和左上角设置 cornerRadius? - how to set cornerRadius for only bottom-left,bottom-right and top-left corner of a UIView? UITextField仅在顶部或底部具有拐角半径 - UITextField with corner radius only on top or bottom 如何在Iphone +上仅在表格视图自定义单元的左上角和右上角半径 - How to corner radius only top left and top right of table view custom cell on Iphone + 右上角和左上角半径无法正常工作 - Top right and top left corner radius is not working properly 从UIImageView的左下角而不是右下角进行页面卷曲动画 - Page curl animation from left bottom corner instead of right bottom corner on UIImageView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM