Now I m developing an project in that I need to show the image with border like below shape.

How can I do this? I have no idea to do this. Please any idea to solve.
May be this code will help you...
 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;
                        Here is how you can create the path for masking:
- (UIBezierPath *)curvedRectWithFrame:(CGRect)frame radius:(CGFloat)radius
{
    double halfFrameHeight = ((double)frame.size.height / 2);
    // Check if the radius is too small.
    if (radius < halfFrameHeight) {
        radius = halfFrameHeight;
    }
    CGFloat arcAngle = asin(halfFrameHeight/radius);
    CGFloat centerX = frame.origin.x + (frame.size.width - radius);
    CGFloat centerY = frame.origin.y + halfFrameHeight;
    UIBezierPath *path = [UIBezierPath bezierPath];
    [path moveToPoint:frame.origin];
    [path addLineToPoint:CGPointMake(centerX + radius * cos(arcAngle), frame.origin.y)];
    [path addArcWithCenter:CGPointMake(centerX, centerY) radius:radius startAngle:-arcAngle endAngle:arcAngle clockwise:YES];
    [path addLineToPoint:CGPointMake(frame.origin.x, path.currentPoint.y)];
    [path closePath];
    return path;
}
Then you can apply the shape mask to your image:
const CGFloat kCurveRadius = 500.;
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = yourImageView.bounds;
maskLayer.path = [self curvedRectWithFrame:maskLayer.bounds radius:kCurveRadius].CGPath;
yourImageView.layer.mask = maskLayer;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With