如何从Web服务xml获取图像? 我希望xml文件中的图像格式化为Web服务中的字节..
答案 0 :(得分:2)
对于上传,你必须像这样工作:
NSString *encodedString=[self encode:(const uint8_t*)_secretData.bytes length:_secretData.length];
encode是一种在“Base64.h”类中定义的方法,您可以从互联网上下载它。
为了检索目的,你必须在解码方法
中传递相同的字符串NSData *data=[Base64 decode:your_string];
并使用数据,您可以执行任何操作,如
UIButton *image = [UIButton buttonWithType:UIButtonTypeCustom];
[image setBackgroundImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
希望它有所帮助!!
答案 1 :(得分:1)
希望这有帮助