我正在尝试将 2 个 uiimages 保存在一起,然后将合并后的图像放入一个名为 finalImage 的图像视图中。但是,我收到错误消息,我已为我的问题分配了标题。只是想把组合的 uiimage 放在图像视图中。
@IBOutlet var finalImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let bottomImage:UIImage = UIImage(named: "pic")!
let topImage:UIImage = UIImage(named:"wall")!
// Change here the new image size if you want
let newSize = CGSize(width: bottomImage.size.width, height: bottomImage.size.height)
UIGraphicsBeginImageContextWithOptions(newSize, false, bottomImage.scale)
bottomImage.draw(in: CGRect(x: 0,y: 0,width: newSize.width,height: newSize.height))
topImage.draw(in: CGRect(x: 0,y: 0,width: newSize.width,height: newSize.height), blendMode:CGBlendMode.normal, alpha:1.0)
let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
//error line
finalImage.image = newImage.images
}