SSZipArchive功能:
- 解压zip文件
- 解压密码保护的zip文件
- 创建zip文件
- 追加到zip文件
- 压缩文件
- 使用一个名字来压缩NSData
使用前:
- 把SSZipArchive文件添加到项目中
- 在target中添加libz.dylib
使用方法:
// 解压
NSString *zipPath = @"被解压的文件路径";
NSString *destinationPath = @"解压到的目录";
[SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath];
// 压缩
NSString *zippedPath = @"压缩文件路径";
NSArray *inputPaths = [NSArray arrayWithObjects:
[[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"],
[[NSBundle mainBundle] pathForResource:@"photo2" ofType:@"jpg"]
nil];
[SSZipArchive createZipFileAtPath:zippedPath withFilesAtPaths:inputPaths];
本文介绍了一个名为SSZipArchive的库,它可以帮助开发者轻松地在iOS应用中进行zip文件的解压和压缩操作。文中提供了详细的使用步骤,包括如何添加库文件到项目中以及具体的代码示例。
1万+

被折叠的 条评论
为什么被折叠?



