0

In mono touch how to create a rounded cornered image. I need to convert my UIImage view to a rounded cornered UIImage. Do anyone have a reference?

Gayan Dinuzhka
  • 331
  • 2
  • 5
  • 16

2 Answers2

1

add this in your

  UIImage *image = [UIImage imageNamed:@"yourimage.jpg"];

    UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 1.0);
    [[UIBezierPath bezierPathWithRoundedRect:imageView.bounds 
                                cornerRadius:10.0] addClip];
    [image drawInRect:imageView.bounds];
    imageView.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
Sport
  • 8,570
  • 6
  • 46
  • 65
  • Hi Sport. Thank you for your solution. But i need a mono touch related solution. This code converting to mono touch is not working for me – Gayan Dinuzhka Nov 28 '14 at 06:41
0

Finally got an answer

UIImageView temp =myimageview;
                RectangleF rect = new RectangleF (temp.Frame.X, temp.Frame.Y, temp.Frame.Width, temp.Frame.Height);
                temp.Image = UIImage.FromFile("images/imagename.png");
                temp.Layer.CornerRadius = temp.Frame.Width/2;
                temp.ClipsToBounds = true;
                temp.ResizableSnapshotView (rect, true, new UIEdgeInsets (0, 50,0, 0));
Gayan Dinuzhka
  • 331
  • 2
  • 5
  • 16