How to make iOS 7 icon image with rounded corners

I have pages to show an icon image in my apps like this :

rounded corner with code

This is one page of released iOS app, Baby Growth Chart. You can see the icon, but the corners looks a little bit strange.
Because the corners are made by next code :
imageView.layer.cornerRadius = 10.f;

You probably know that the shape of the corners has changed since iOS 7.
Everyone would be happy if the corder could be made by code like above. But there seems to be no api which can make the corner. So I made a png image for mask with iDraw by myself :

mask image

You can make the corners with this kind of code :

imageView.layer.mask = maskView.layer;

Then the squared image has the nice shape of corners like this :

masked icon

It look good, doesn’t it?
Develop | Comments(0) | Trackback(0)