cell.imageView?.sd_setImage(with: NSURL.init(string: imageStr ) as URL!, placeholderImage: UIImage.init(named: "usericon.png"))
//改变图片大小
let itemSize:CGSize = CGSize.init(width: 50, height: 50)
UIGraphicsBeginImageContextWithOptions(itemSize, false, UIScreen.main.scale)
let rect11 :CGRect = CGRect.init(x: 0, y: 0, width: itemSize.width, height: itemSize.height)
cell.imageView?.image?.draw(in: rect11)
cell.imageView?.image = UIGraphicsGetImageFromCurrentImageContext()
cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 13)
cell.selectionStyle = .none
cell.imageView?.layer.masksToBounds = true
cell.imageView?.layer.cornerRadius = 25
本文介绍如何使用SwiftUI调整UIImageView中的图片大小,并设置图片的圆角和阴影效果等样式属性。通过创建合适尺寸的上下文并利用UIGraphicsGetImageFromCurrentImageContext获取新的图片,可以有效地调整图片大小。
9004

被折叠的 条评论
为什么被折叠?



