Making round corners for a UIImage

↘锁芯ラ 提交于 2020-01-04 06:53:25

问题


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:


try this way:

UIImageView *imageView = ...;
imageView.layer.cornerRadius = 7; // change this value  as per your desire
imageView.clipsToBounds = YES;


来源:https://stackoverflow.com/questions/8938800/making-round-corners-for-a-uiimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!