How to display a base64 image within a UIImageView?

后端 未结 11 2198
攒了一身酷
攒了一身酷 2020-11-30 00:56

I got this Base64 gif image:

R0lGODlhDAAMALMBAP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAACH5BAUKAAEALAAAAAAMAAwAQAQZMMhJK7iY4p3nlZ8XgmN         


        
11条回答
  •  情话喂你
    2020-11-30 01:52

    Just in case anyone is looking for the Swift code to accomplish this (based on the Objective-C answer provided by Jonathan M), here it is:

    var data = NSData (base64EncodedString: base64String, options: NSDataBase64DecodingOptions(0))
    var image = UIImage(data: data!)
    

提交回复
热议问题