图片左右圆角不一致需要注意的坑
UIImageView *imgView = [[UIImageView alloc] init];
//frame的设置用frame没问题,sd的约束没问题,masonry不行
imgView.frame=CGRectMake(100,100,80,80);
imgView.image= [UIImageimageNamed:@"wejkjg"];
[self.viewaddSubview:imgView];
imgView.layer.cornerRadius=5;
imgView.layer.masksToBounds = YES;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:imgView.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer*maskLayer = [[CAShapeLayeralloc]init];
maskLayer.frame= imgView.bounds;
maskLayer.path= maskPath.CGPath;
imgView.layer.mask= maskLayer;
希望可以帮到大家,我也是前两个有这个需求做了下,发现这个 问题的。
网友评论