IOS: create a UIImage or UIImageView with rounded corners

后端 未结 12 770
执笔经年
执笔经年 2020-12-07 07:26

Is it possible create an UIImage or an UIImageView with rounded corners? Because I want take an UIImage and show it inside an UI

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 07:52

    Yes, it is possible.
    Import the QuartzCore (#import ) header and play with the layer property of the UIImageView.

    yourImageView.layer.cornerRadius = yourRadius;
    yourImageView.clipsToBounds = YES;
    

    See the CALayer class reference for more info.

提交回复
热议问题