如何在图像视图的三个角半径

时间:2016-03-16 06:02:05

标签: objective-c io

enter image description here

如何绘制图像角半径只有三个角看我的图像。 请告诉我怎么做这个..?提前谢谢。

1 个答案:

答案 0 :(得分:1)

你可以做点什么,

UIBezierPath *maskPath;
    maskPath = [UIBezierPath bezierPathWithRoundedRect:YourImageView.bounds
                                     byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerTopLeft|UIRectCornerTopRight)
                                           cornerRadii:CGSizeMake(4.0, 4.0)];

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

编辑:

    YourImageView.clipsToBounds=YES;
    YourImageView.layer.borderWidth = 1;
    YourImageView.layer.borderColor = [[UIColor blueColor] CGColor];

确保您导入QuartzCore框架:

#import <QuartzCore/QuartzCore.h>