ziparchive是基于开源代码”MiniZip”的zip压缩与解压的Objective-C 的Class,使用起来非常的简单.你只需要把代码加进你的工程,然后把zlib库添加到工程就可以了.
压缩:
ZipArchive可以压缩多个文件,只需要把文件一一addFileToZip即可.
- ZipArchive* zip = [[ZipArchive alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *dcoumentpath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSString* l_zipfile = [dcoumentpath stringByAppendingString:@"/test.zip"] ;NSString* image1 = [dcoumentpath stringByAppendingString:@"/image1.jpg"] ;
NSString* image2 = [dcoumentpath stringByAppendingString:@"/image2.jpg"] ;BOOL ret = [zip CreateZipFile2:l_zipfile];
ret = [zip addFileToZip:image1 newname:@"image1.jpg"];
ret = [zip addFileToZip:image2 newname:@"image2.jpg"];
if( ![zip CloseZipFile2] )
{
l_zipfile = @”";
}
[zip release];
解压缩:
- ZipArchive* zip = [[ZipArchive alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *dcoumentpath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;NSString* l_zipfile = [dcoumentpath stringByAppendingString:@"/test.zip"] ;
NSString* unzipto = [dcoumentpath stringByAppendingString:@"/test"] ;
if( [zip UnzipOpenFile:l_zipfile] )
{
BOOL ret = [zip UnzipFileTo:unzipto overWrite:YES];
if( NO==ret )
{
}
[zip UnzipCloseFile];
}
[zip release];
This article was written in springnote.
Phentermine directory
Buy cheap tramadol
Acomplia online
Accutane side effects
Cialis prescription
Vicodin es
Tramadol hcl
Acai berry supreme
What does valium look like
Tadalafil
Allegra credit
Effexor xr
Meridia side effects
Ultram euphoria
Phentermine capsule
Tramadol hcl
Cialis side effects
Buy meridia
Discount cialis
Propecia side effects
Symptoms vicodin addiction
Order carisoprodol
Try viagra for free
Viagra for women
Hydrocodone apap 5 500
Zoloft zoloft
Paypal meridia
Percocet without prescription
Buy tadalafil online
Viagra sample
Adipex no prescription
Buy phentermine no prescription
Generic percocet
http://community.tasteofhome.com/members/Medlineplus_5F00_drug_5F00_information_5F00_lorazepam_5F005F00_43/default.aspx
http://community.tasteofhome.com/members/Adderall_5F00_and_5F00_tooth_5F00_discoloration_5F005F00_63/default.aspx
http://community.tasteofhome.com/members/Acai_5F00_berries_5F00_side_5F00_affects_5F005F00_66/default.aspx
http://community.tasteofhome.com/members/Breaking_5F00_an_5F00_addiction_5F00_to_5F00_hydrocodone_5F005F00_76/default.aspx
http://community.tasteofhome.com/members/How_5F00_long_5F00_does_5F00_ambien_5F00_withdrawal_5F00_last_5F005F00_31/default.aspx
http://community.tasteofhome.com/members/Clonazepam_5F00_and_5F00_sleep_5F00_disorders_5F005F00_47/default.aspx
http://community.tasteofhome.com/members/How_5F00_fast_5F00_does_5F00_cipro_5F00_start_5F00_working_5F005F00_72/default.aspx
http://community.tasteofhome.com/members/What_5F00_doses_5F00_does_5F00_seroquel_5F00_come_5F00_in_5F005F00_22/default.aspx
http://community.tasteofhome.com/members/How_5F00_to_5F00_decrease_5F00_ativan_5F005F00_37/default.aspx
又是一连串代码,it is so hard to realize