0

I have a requirement in which i need to crop the UIImage's top right and bottom right corner with specified radius. The final output shall look like below image's coreners

enter image description here

Can you any one please help me out?

rmaddy
  • 298,130
  • 40
  • 468
  • 517
thavasidurai
  • 1,934
  • 1
  • 25
  • 47

2 Answers2

8
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:_backgroundImageView.bounds byRoundingCorners:(UIRectCornerTopRight | UIRectCornerBottomRight)cornerRadii:CGSizeMake(5.0, 5.0)];

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

self is my Custom table view Cell .

iBhavin
  • 1,878
  • 14
  • 30
-1

The simple way to do this

 ImageView.layer.cornerRadius  = 10.0f;
    ImageView.layer.borderWidth = 1.0f;
    ImageView.layer.borderColor = [[UIColor  whiteColor] CGColor];

And cover the left side with equal background color . Then it'll be appear like right top and right bottom is cornered

Code cracker
  • 2,782
  • 6
  • 31
  • 57