NSdata 与 UIImage 的相互转换

NSData->UIImage
UIImage *aimage = [UIImage imageWithData: imageData];

UIImage-> NSData
NSData *imageData = UIImagePNGRepresentation(aimage);

时间: 2024-11-05 20:31:48

NSdata 与 UIImage 的相互转换的相关文章

NSdata 与 NSString,Byte数组,UIImage 的相互转换

1. NSData 与 NSString NSData-> NSString NSString *aString = [[NSString alloc] initWithData:adataencoding:NSUTF8StringEncoding]; NSString->NSData NSString *aString = @"1234abcd"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncodi

NSData与NSString、Byte数组,UIImage的相互转换

1.NSData与NSString NSData -> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString->NSData NSString *aString = @"1234abcd"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncodin

ios -- NSdata 与 NSString,Byte数组,UIImage 的相互转换(转)

1. NSData 与 NSStringNSData-> NSStringNSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString->NSDataNSString *aString = @"1234abcd";NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding]

ios -- NSdata 与 NSString,Byte数组,UIImage 的相互转换

---恢复内容开始--- 1. NSData 与 NSStringNSData-> NSStringNSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString->NSDataNSString *aString = @"1234abcd";NSData *aData = [aString dataUsingEncoding: NSUTF8St

NSData与UIImage之间的转换

1 //NSData转换为UIImage 2 NSData *imageData = [NSData dataWithContentsOfFile: imagePath]; 3 UIImage *image = [UIImage imageWithData: imageData]; 4 5 //UIImage转换为NSData 6 NSData *imageData = UIImagePNGRepresentation(aimae);

NSData 与UIimage 关系 然后 压缩

1 //NSData转换为UIImage2 NSData *imageData = [NSData dataWithContentsOfFile: imagePath];3 UIImage *image = [UIImage imageWithData: imageData];4 5 //UIImage转换为NSData6 NSData *imageData = UIImagePNGRepresentation(aimae); 1 //对图片尺寸进行压缩-- 2 -(UIImage*)image

iOS中NSString,NSData和char的相互转换,JSON串转化为NSDictionary或NSArray

1.NSString 转换成NSData 对象 NSData* xmlData = [@"testdata" dataUsingEncoding:NSUTF8StringEncoding]; 2.NSData 转换成NSString对象 NSData * data; NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 3.NSData 转换成char* NSData

Object-C 中各数据类型转换 NSData转NSString,Byte,UIImage

1,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString --> NSData NSString *aString = @"1234"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncod

<iOS>UIImage变为NSData并进行压缩

http://www.cnblogs.com/robinkey/archive/2013/01/21/2869930.html //sdk中提供了方法可以直接调用 UIImage *img = [UIImage imageNamed:@"some.png"]; NSData *dataObj = UIImageJPEGRepresentation(img, 1.0); //下面是sdk中UIImage.h头文件中的内容 UIKIT_EXTERN NSData *UIImagePNGRe