NSData转NSString

 

这种方法效率低下

NSData *data = UIImagePNGRepresentation(image);
NSMutableString *picStr = [NSMutableString stringWithString:@"["];
Byte *dataByte = (Byte *)[data bytes];
int length = [data length];
//字节流转nsstring;
for(int i = 0;i < length;i++){
[picStr appendFormat:@"%d,",(int8_t)dataByte[i]];
}

posted on 2012-10-10 17:26  kiao295338444  阅读(154)  评论(0编辑  收藏  举报

导航