将uiimage视图转换为uiimage

时间:2018-07-04 07:06:35

标签: ios uiimageview uiimage

    func mapView(_ mapView: MapViewPlus, imageFor annotation: AnnotationPlus) -> UIImage {

    let image: UIImage! = UIImage(named: "basic_annotation_image.png")
    let imageView: UIImageView = UIImageView(image: image)
    imageView.layer.cornerRadius = imageView.frame.width / 2
    imageView.clipsToBounds = true
    imageView.layer.borderColor =  UIColor.white.cgColor
    imageView.layer.borderWidth = 4

    // Now i want to convert this imageView to UIImage

    return UIImage(named: "basic_annotation_image.png")!
}

我想将 UIImageView转换为UIImage 。有人知道该怎么做吗?[在此处输入图片描述]

1 个答案:

答案 0 :(得分:0)

您不能将UIImageView转换为UIImage,但是可以使用UIImageView中的图像:

let image: UIImage = yourImageView.image