How to zip folders in iPhone SDK?

后端 未结 5 504
情话喂你
情话喂你 2020-12-09 06:45

In my Application,I am taking screenshots of image View and then I am saving those screen shots in document folder of the application.Now I want to Email all those images wi

5条回答
  •  旧巷少年郎
    2020-12-09 07:08

    To create a zip file you can use ZipArchive Download the source code and add it to your project, add also libz.x.dylib (take a look at wiki).

    Then in your header file add: #import "ZipArchive/ZipArchive.h"

    To create a zip file is simple, just use the following code:

    BOOL ret = [zip CreateZipFile2:l_zipfile];
    // OR
    BOOL ret = [zip CreateZipFile2:l_zipfile Password:@"your password"]; //
    //if the Password is empty, will get the same effect as [zip CreateZipFile2:l_zipfile];
    ret = [zip addFileToZip:l_photo newname:@"photo.jpg"];
          if( ![zip CloseZipFile2] )
          {
          // error handler here
          }
          [zip release];
    

提交回复
热议问题