1
由于我保存的图像具有透明部分,但将其保存在Document文件夹中时,透明部分变为白色。iPhone应用程序的文档文件夹中的透明UIImage
下面是代码....
NSData *dataPhoto = UIImageJPEGRepresentation(imageBigPhoto, 1.0);
//NSData *dataPhoto = UIImagePNGRepresentation(imageBigPhoto);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPathWithFoldername=[documentsDirectory stringByAppendingFormat:@"/%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"PhotoFolderName"]];
//NSLog(@"%@",fullPathWithFoldername);
NSString *fullPath = [fullPathWithFoldername stringByAppendingPathComponent:name];
[dataPhoto writeToFile:fullPath atomically:YES];
我看到你已经从PNG切换到JPEG格式。 PNG是否有同样的问题? – Ariel 2012-03-07 11:29:41
JPEG不会透明。 – ssteinberg 2012-03-07 11:30:25