ios swift圆形按钮和圆形图标

来源:互联网 发布:东华his数据库 编辑:程序博客网 时间:2024/05/07 17:49

UIButton

// 按钮的边角指定为长度一半self.button.imageView?.layer.cornerRadius = avatarImageButton.frame.width / 2


UIImage

// 圆角指定为长度一半self.image.layer.cornerRadius = avatarImage.frame.width / 2// image还需要加上这一句, 不然无效self.image.layer.masksToBounds = true

0 0