Convert UIImage to NSData and convert back to UIImage in Swift?

前端 未结 9 1511
一向
一向 2020-12-02 07:33

I\'m trying to save a UIImage to NSData and then read the NSData back to a new UIImage in Swift. To convert the UII

9条回答
  •  醉话见心
    2020-12-02 08:00

    Swift 5

    let the image you create as UIImage be image

    image.pngData() as NSData? 
    

提交回复
热议问题