如何从“Base64String'格式原始图像数据获取的UIImage,iPhone上的?

编程入门 行业动态 更新时间:2024-10-26 00:31:13
本文介绍了如何从“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上的?

本文发布于:2023-11-26 19:32:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634908.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   原始   格式   数据   Base64String

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!