现在我开发一个项目,我需要显示带有边框的图像,如下面的形状.
我怎样才能做到这一点?我不知道这样做.请任何想法解决.
解决方法
可能这段代码会帮你…
UIBezierPath *maskPath; maskPath = [UIBezierPath bezierPathWithRoundedRect:YourImageVIew.bounds byRoundingCorners:(UIRectCornerTopRight | UIRectCornerBottomRight) cornerRadii:CGSizeMake(50.0,50.0)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = YourImageVIew.bounds; maskLayer.path = maskPath.CGPath; YourImageVIew.layer.mask = maskLayer;