如何从“Base64String'格式原始图像数据获取的UIImage,iPhone上的? [英] How to Get UIImage from a 'Base64String' format raw image data, on iPhone?

查看:160
本文介绍了如何从“Base64String'格式原始图像数据获取的UIImage,iPhone上的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的申请,我收到一个XML文件从服务器的图像数据。这个数据是一个图像(JPEG格式或.png或.TIFF等)的服务器,转换成Base64String'格式字节通过XML文件发送给我的应用程序。在我的应用方面,应用商店这些字节,在'的NSData'的形式进入数据库。
   现在,我的应用程序来检索,并在后期出现的形象。但我一直无法弄清楚如何摆脱这个'Base64String格式的原始图像数据的UIImage?
   请指导我在这方面,因为我是'刚刚好'的iPhone应用程序开发的世界开发者。

In my application, I receive the image data from the server in a XML file. This data is of an image( .jpeg or .png or .tiff etc) which the server, converts into 'Base64String' format bytes to send to my application through the XML file. At my application side, the application stores these bytes, in the form of 'NSData' into a database. Now, my application has to retrieve and show up the image at the later part. But I haven't been able to figure out how to get the UIImage from this 'Base64String' format raw image data? Kindly guide me in this regard, since I'm a 'just-in' developer in the world of iPhone app development.

感谢您在我的AP preciate任何帮助阅读。

Thanks for reading through and I appreciate any help.

推荐答案

此页面在CocoaDev维基包含字符串的base64解码的多种实现。在页面底部的NSData的类别可能是在你的应用程序中集成最简单的。

This page on the CocoaDev wiki contains several implementations of base64 decoding from strings. The NSData category at the bottom of the page is probably the simplest to integrate in your application.

从那里,你可以提取您的Base64恩codeD字符串的一个NSData重新presentation。 NSData的可使用的UIImage imageWithData初始化一个UIImage实例:或initWithData:构造

From there, you can extract an NSData representation of your base64-encoded string. The NSData can be used to initialize a UIImage instance using the UIImage imageWithData: or initWithData: constructors.

这篇关于如何从“Base64String'格式原始图像数据获取的UIImage,iPhone上的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆