不能指定'[uiimage]类型的值?输入uiimage(swif3)

时间:2017-06-08 17:39:18

标签: ios swift3 uiimageview uiimage blend-mode

我正在尝试将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

    }

1 个答案:

答案 0 :(得分:3)

你的newImage是UIImage,所以把

finalImage.image = newImage

因为您在UIImage

中有[UIImage]类型,而不是finalImage.image - UIImage对象数组