Making round corners for a UIImage

2019-07-17 08:13发布

In my iPhone application I have to show a UIImage with its all four corners curved so that it looks good on the screen. But my image is a rectangular image which cannot be altered at image level as it comes from a third party.

With UIImageView I can set the frame. Using code, how can I modify my UIImage to have rounded corners?

Any clue?

1条回答
神经病院院长
2楼-- · 2019-07-17 08:36

try this way:

UIImageView *imageView = ...;
imageView.layer.cornerRadius = 7; // change this value  as per your desire
imageView.clipsToBounds = YES;
查看更多
登录 后发表回答