Iphone 目标-Zip仅适用于文本文件?
我正在使用Objective Zip库来解压iPhone中的文件 所有作品都很好,除了文本文件没有问题外,解压没有问题,文件是正确的。但是压缩后的png文件都被破坏了。这些文件的大小都与原始文件相同,但都已损坏 代码如下:Iphone 目标-Zip仅适用于文本文件?,iphone,zip,Iphone,Zip,我正在使用Objective Zip库来解压iPhone中的文件 所有作品都很好,除了文本文件没有问题外,解压没有问题,文件是正确的。但是压缩后的png文件都被破坏了。这些文件的大小都与原始文件相同,但都已损坏 代码如下: -(void)installPackageFromZipFile:(NSString *)zipFile { NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirector
-(void)installPackageFromZipFile:(NSString *)zipFile
{
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:zipFile mode:ZipFileModeUnzip];
packageRegisterController *pckReg = [[packageRegisterController alloc] init];
[unzipFile goToFirstFileInZip];
NSArray *infos= [unzipFile listFileInZipInfos];
for (FileInZipInfo *info in infos)
{
NSLog([NSString stringWithFormat:@"File Found in Zip File- %@ Size:%d", info.name, info.length]);
ZipReadStream *read = [unzipFile readCurrentFileInZip];
if (![pckReg detectIfFileExists:[documentsDir stringByAppendingPathComponent:info.name]])
{
NSMutableData *data = [[NSMutableData alloc] initWithLength:info.length];
int bytesRead = [read readDataWithBuffer:data];
[data writeToFile:[documentsDir stringByAppendingPathComponent:info.name] atomically:NO];
[read finishedReading];
[data release];
if ([[NSString stringWithFormat:@"%@",info.name] isEqualToString:@"TEMAMANIFEST.xml"])
{
if([self parseManifest:[documentsDir stringByAppendingPathComponent:info.name]])
if ([pckReg validateManifestId:self.temaToInstall.idManifest])
[self installManifest];
}
}
[unzipFile goToNextFileInZip];
}
[unzipFile close];
[unzipFile release];
}
此函数用于解压缩所有大小合适的文件,文本文件正常,但不是png
有人能帮我吗?你是想在iPhone应用程序中查看图像,还是想在Mac上压缩、解压并在那里查看图像 PNG在为iPhone构建时是“优化”的,因此,如果没有“未优化”,在mac上就无法查看PNG 当PNG被复制到iPhone应用程序包时,它们通过
pngcrush
实用程序发送,该实用程序获取图像的alpha通道值,并与其他颜色通道(红色、蓝色和绿色)进行预乘。结果是在Mac电脑上无法看到图像,但在iPhone上却可以快速、轻松地渲染图像
之所以这样做,是因为iPhone的图形处理器在硬件上不进行alpha乘法,但在软件上进行,这使得它的速度变慢。
pngcrush
实用程序执行构建过程中所需的所有alpha乘法,以便硬件图形处理器可以非常快速地渲染所有图像。您是在iPhone应用程序中查看图像,还是在Mac上压缩、解压缩图像并尝试在那里查看图像
PNG在为iPhone构建时是“优化”的,因此,如果没有“未优化”,在mac上就无法查看PNG
当PNG被复制到iPhone应用程序包时,它们通过pngcrush
实用程序发送,该实用程序获取图像的alpha通道值,并与其他颜色通道(红色、蓝色和绿色)进行预乘。结果是在Mac电脑上无法看到图像,但在iPhone上却可以快速、轻松地渲染图像
之所以这样做,是因为iPhone的图形处理器在硬件上不进行alpha乘法,但在软件上进行,这使得它的速度变慢。
pngcrush
实用程序执行构建过程中所需的所有alpha乘法,以便硬件图形处理器可以非常快速地渲染所有图像。您是否尝试在另一个框中解压缩zip文件,并确保其正确压缩?勾选我在这个问题中的答案:-您是否尝试在另一个盒子上解压缩压缩文件,并确保其正确压缩?勾选我在这个问题中的答案:-