压缩 解压缩

ZipArchive

压缩 解压缩_第1张图片
ZipArchive.png

添加 libz.dylib

#import "Main.h"

- (void)zipToUnzip{
    [Main unzipFileAtPath:@"/Users/admin/Desktop/zip/solozyx.zip"
            toDestination:@"/Users/admin/Desktop/unzip/solozyx/"];
}

- (void)unzipToZip{
    [Main createZipFileAtPath:@"/Users/admin/Desktop/zip/solozyx.zip"
      withContentsOfDirectory:@"/Users/admin/Desktop/unzip/solozyx/"];
}

- (void)zip{
    NSArray *paths = @[@"/Users/admin/Desktop/unzip/1.png",
                       @"/Users/admin/Desktop/unzip/2.png"];
    [Main createZipFileAtPath:@"/Users/admin/Desktop/zip/png.zip" 
             withFilesAtPaths:paths];
}

SSZipArchive

压缩 解压缩_第2张图片
SSZipArchive.png
#import 

[SSZipArchive createZipFileAtPath:<#(NSString *)#> withFilesAtPaths:<#(NSArray *)#>];
[SSZipArchive createZipFileAtPath:<#(NSString *)#> withContentsOfDirectory:<#(NSString *)#>];

你可能感兴趣的:(压缩 解压缩)