-4

Please help me!!! How create a rounded inflated square UIImageView. I need to create icons as a contact such as in the viber application . Sample image

https://graphicdesign.stackexchange.com/questions/35579/create-a-rounded-inflated-square-in-illustrator-photoshop

I Asked about rounded INFLATED square, And i think questions have a different.

Community
  • 1
  • 1

2 Answers2

1

The easy way to do it is to use a mask and apply it to your image.

 - (UIImage*) maskImage:(UIImage *)image withMask:(UIImage *)maskImage {

    CGImageRef maskRef = maskImage.CGImage; 

    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
        CGImageGetHeight(maskRef),
        CGImageGetBitsPerComponent(maskRef),
        CGImageGetBitsPerPixel(maskRef),
        CGImageGetBytesPerRow(maskRef),
        CGImageGetDataProvider(maskRef), NULL, false);

    CGImageRef masked = CGImageCreateWithMask([image CGImage], mask);
    return [UIImage imageWithCGImage:masked];

}

See this tutorial : http://iosdevelopertips.com/cocoa/how-to-mask-an-image.html#comment-47347

And the stackoverflow topic about your issue: How to Mask an UIImageView

Community
  • 1
  • 1
jregnauld
  • 1,288
  • 18
  • 17
0

Possible duplicate here: Draw iOS 7-style squircle programatically

Anyway, what you want is a squircle/superellipse. Read up on the uibezierpath and customize the curves bigger for your usage.

Community
  • 1
  • 1
Jake Crastly
  • 462
  • 3
  • 9