NSData和UIImage [英] NSData and UIImage

查看:92
本文介绍了NSData和UIImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 NSData 加载 UIImage 对象,示例代码为 NSImage ,我猜他们应该是一样的。但是刚刚加载图像,我想知道什么是最好的解决 UIImage 加载 NSData 问题。

I am trying to load UIImage object from NSData, and the sample code was to NSImage, I guess they should be the same. But just now loading the image, I am wondering what's the best to troubleshoot the UIImage loading NSData issue.

推荐答案

UIImage有一个 - initWithData:方法。从文档:数据参数中的数据必须格式化,以匹配系统支持的图像类型之一的文件格式。

UIImage has an -initWithData: method. From the docs: "The data in the data parameter must be formatted to match the file format of one of the system’s supported image types."

这篇关于NSData和UIImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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