TuSDKGeeV2 主题包是 2.6.0 之后新增的一个主题包,主要的功能是多图编辑组件,包含:相机组件,多选相册组件,拍照预览组件和图片编辑组件。文档以 Demo 代码为例,展示组件的使用方法。GeeV2Sample 中的代码进行组件的调用。不要更改组件的代码顺序。#import <TuSDKGeeV2/TuSDKGeeV2.h>。@interface GeeV2Sample()<GeeV2PFCameraDelegate>{
    // ****这里很重要****
    // 需要组件声明称全局变量
    // 多图片编辑组件
    GeeV2CPPhotoEditMultipleComponent *_photoEditMultipleComponent;
    // 相册组件
    GeeV2CPAlbumMultipleComponent *_albumComponent;
    // 照片美化最大可编辑数量 和 多选相册选择的最大照片数量必须保持一致
    NSUInteger _maxSelection;
}
@end
self 。_maxSelection = 9;    // 使用 G2 主题包多图片编辑组件需要在提前选择主题包的`style`。
    [TuSDK shared].style = @"ui_geeV2";
    // 使用默认主题包的组件需要在组件启动前提前选择主题包的`style`,避免默认主题包组件 UI 显示异常。
    // [TuSDK shared].style = lsqSdkUIDefault;
    // 开启组件(开启之前请设置 _maxSelection )
    _albumComponent =
    [TuSDKGeeV2 albumMultipleCommponentWithController:controller
                                        callbackBlock:^(TuSDKResult *result, NSError *error, UIViewController *controller)
     {
         if (error) {
             lsqLError(@"album reader error: %@", error.userInfo);
             return;
         }
         [result logInfo];
         // 从 result.imageAssets 中取出相册选择的照片对象
         // 创建一个数组存放选择的照片对象,以便于最后图片编辑完成之后编辑结果的输出
         NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:result.imageAssets.count];
         for (id<TuSDKTSAssetInterface> asset in result.imageAssets) {
             TuSDKResult *result = [TuSDKResult result];
             result.imageAsset = asset;
             [resultArray addObject:result];
         }
         // 开启多图片编辑组件,并将创建的数组 resultArray 传给多图片编辑组件。
         [self openEditMultipleWithController:controller result:resultArray];
     }
     openCameraCallback:^(GeeV2PFAlbumMultipleViewController *controller) {
         // 开启访问相机权限
         [TuSDKTSDeviceSettings checkAllowWithController:controller
                                                    type:lsqDeviceSettingsCamera
                                               completed:^(lsqDeviceSettingsType type, BOOL openSetting)
          {
              if (openSetting) {
                  lsqLError(@"Can not open camera");
                  return;
              }
              [self showCamera:controller];
          }];
     }
     // 设置最大选择的图片 (默认为 3 ,最大可以设置 9)
     maxSelectionNumber:_maxSelection];
    // 组件选项配置(API 网址链接,可查看对应的接口介绍)
    // @see-https://tusdk.com/docs/ios/image/api-geev2/Classes/GeeV2CPAlbumMultipleOptions.html
    // _albumComponent.options
    // @see-https://tusdk.com/docs/ios/image/api-geev2/Classes/GeeV2PFAlbumMultipleOptions.html
    // _albumComponent.options.albumOptions
    // @see-https://tusdk.com/docs/ios/image/api-geev2/Classes/GeeV2PFCameraOptions.html
    // _albumComponent.options.cameraOptions
    // 是否在组件执行完成后自动关闭组件 (默认:NO)
    // _albumComponent.autoDismissWhenCompelted = YES;
    [_albumComponent showComponent];
/**
 *  启动相机
 *
 *  @param controller 启动控制器
 */
- (void)showCamera:(GeeV2PFAlbumMultipleViewController *)controller;
{
    // 组件选项配置
    // @see-https://tusdk.com/docs/ios/image/api-geev2/Classes/GeeV2PFCameraOptions.html
    GeeV2PFCameraViewController *cameraController = _albumComponent.options.cameraOptions.viewController;
    // 添加委托
    cameraController.delegate = self;
    cameraController.openedByAlbumController = YES;
    [controller pushViewController:cameraController animated:YES];
}
- (void)openEditMultipleWithController:(UIViewController *)controller
                                result:(NSArray<TuSDKResult *>*)inputResults;
    _photoEditMultipleComponent =
    [TuSDKGeeV2 photoEditMultipleWithController:controller
                                  callbackBlock:^(NSArray<TuSDKResult *> *outputResults, NSError *error, UIViewController *controller)
     {
         // 获取图片失败
         if (error) {
             lsqLError(@"editMultiple error: %@", error.userInfo);
             return;
         }
         // 输出 outputResults 中的图片信息
         for (TuSDKResult *result in outputResults)
         {
             [result logInfo];
         }
         //
         // 可在此添加自定义方法,在编辑完成时进行页面跳转操,例如 :
         // [controller presentViewController:[[UIViewController alloc] init] animated:YES completion:nil];
         // 图片处理结果 NSArray<TuSDKResult *> 的数组,数组中是 TuSDKResult 类型的对象。
         // TuSDKResult *firstResult 可获取的数据类型是 :
         // firstResult.imagePath 是 NSString 类型
         // firstResult.imageAsset 是 TuSDKTSAssetInterface 类型
         // 可使用以下方式进行转换
         // 从数组中获取到第一张图片的 TuSDKResult 对象
         // TuSDKResult *firstRusult = [outputResults objectAtIndex:0];
         // 通过转换 firstRusult.imageAsset 获取 UIImage
         // UIImage *firstOriginalImage = [firstRusult.imageAsset fullResolutionImage];
         // 通过转换 firstRusult.imagePath 获取 UIImage
         // UIImage *firstTempFileImage = [UIImage imageWithContentsOfFile:firstRusult.imagePath];
         // 下面以 UIImage 类型的编辑结果举例,如何将编辑结果持有并进行其他操作。
         // 使用 TuSDKTSAssetInterface 和 NSString 类型。
         // 可在此添加自定义方法,将编辑结果结果传出,例如 :  [self openEditorWithImage:firstOriginalImage];
         // 并在外部使用方法接收编辑结果,例如 : -(void)openEditorWithImage:(UIImage *)image;
         // 用户也可以在编辑结果的外部接受的方法中实现页面的跳转操作,用户可根据自身需求使用。
         // 用户在获取到 firstOriginalImage 结果并跳转到其他页面进行操作的时候可能会出现无法持有对象的情况
         // 此时用户可以将 UIImage 类型的对象转换成 NSData 类型的对象,然后再进行操作,例如 :
         // NSData *imageData = UIImageJPEGRepresentation(firstOriginalImage, 1.0);
         // UIViewController *viewController = [[UIViewController alloc]init];
         // [self.controller pushViewController:viewController animated:YES];
         // viewController.currentImage = [UIImage imageWithData:imageData];
         // 获取 result 对象的不同属性,需要对 option 选项中的保存到相册和保存到临时文件相关项进行设置。
         // 获取多个编辑结果,请将多个编辑结果一起处理或者添加至数组中,将对应数组传出。
         // 
     }];
    _photoEditMultipleComponent.options.editMultipleOptions.maxSelectionNumber = _maxSelection;
    _photoEditMultipleComponent.inputResources = inputResults;
    // 是否在组件执行完成后自动关闭组件 (默认:NO)
    _photoEditMultipleComponent.autoDismissWhenCompelted = YES;
    // 当上一个页面是NavigationController时,是否通过 pushViewController 方式打开编辑器视图 (默认:NO,默认以 presentViewController 方式打开)
    // SDK 内部组件采用了一致的界面设计,会通过 push 方式打开视图。如果用户开启了该选项,在调用时可能会遇到布局不兼容问题,请谨慎处理。
    _photoEditMultipleComponent.autoPushViewController = YES;
    [_photoEditMultipleComponent showComponent];
TuSDK 的多图片编辑组件为用户提供了 6 种功能模块,分别是 编辑 贴纸 滤镜 美颜 调整 涂抹。
选择性使用,示例代码禁止贴纸功能模块,不使用的模块可禁用,不设置该选项将默认加载全部模块
   [_photoEditMultipleComponent.options.editMultipleOptions disableModule:lsqTuSDKCPEditActionSticker];
    _photoEditMultipleComponent.options.editMultipleOptions.saveToAlbum = YES;
    _photoEditMultipleComponent.options.editMultipleOptions.saveToAlbumName = @"TuSDK";
    _photoEditMultipleComponent.options.editMultipleOptions.saveToTemp = YES;
用户需要拿到临时文件,这个选项需要配置 NO    _photoEditMultipleComponent.options.editMultipleOptions.isAutoRemoveTemp = YES;
    _photoEditMultipleComponent.options.editMultipleOptions.waterMarkOption = [self waterMarkOption];
    _photoEditMultipleComponent.options.editMultipleOptions.maxSelectionNumber = _maxSelection; 
    _photoEditMultipleComponent.options.editMultipleOptions.disableStepsSave = YES;
    _photoEditMultipleComponent.options.editMultipleOptions.showResultPreview = NO;
如果设置了LimitSideSize, 将忽略LimitForScreen    _photoEditMultipleComponent.options.editMultipleOptions.limitForScreen = YES;
    _photoEditMultipleComponent.options.editMultipleOptions.limitSideSize = 800;
    _photoEditMultipleComponent.options.editMultipleOptions.enableAlwaysSaveEditResult = YES;
继承 GeeV2PFEditMultipleController 类的子类指定给组件,这样组件就会自动调用子类中重写的相应方法。    _photoEditMultipleComponent.options.editMultipleOptions.componentClazz = [GeeV2PFEditMultipleController class];
继承 GeeV2PFEditMultipleView 类的子类指定给组件,这样组件就会自动调用子类中重写的相应方法。    _photoEditMultipleComponent.options.editMultipleOptions.viewClazz = [GeeV2PFEditMultipleView class];
编辑 贴纸 滤镜 美颜 调整 涂抹。常用的设置配置主要是裁剪,滤镜和涂抹功能    _photoEditMultipleComponent.options.editFilterOptions.outputCompress = 0.95f;
    _photoEditMultipleComponent.options.editFilterOptions.filterBarCellWidth = 75;
    _photoEditMultipleComponent.options.editFilterOptions.filterBarHeight = 100;
    _photoEditMultipleComponent.options.editFilterOptions..displayFilterSubtitles = YES;
    _photoEditMultipleComponent.options.editFilterOptions.isRenderFilterThumb = YES;
    _photoEditMultipleComponent.options.editSmudgeOptions.defaultBrushSize = lsqMediumBrush;
    _photoEditMultipleComponent.options.editSmudgeOptions.saveLastBrush = YES;
    _photoEditMultipleComponent.options.editSmudgeOptions.maxUndoCount = 5;
使用 TuSDK 的多图片编辑组件,可以通过设置不同的属性以方便管理编辑结果及输出方式。
两种方式获得图片的处理结果:
获取图片的存储路径,此方式会将图片保存在相册中
将图片保存在临时文件中,并获取临时文件
您需要进行如下设置:
    // 保存到系统相册
    _photoEditMultipleComponent.options.editMultipleOptions.saveToAlbum = YES;
    // 保存到临时文件
    _photoEditMultipleComponent.options.editMultipleOptions.saveToTemp = NO;
该方式会将处理结果保存到相册中。
同时您也可以设置
    // 保存到系统相册的相册名称
    _photoEditMultipleComponent.options.editMultipleOptions.saveToAlbumName = @"TuSdk";
将图片保存到名称为 TuSdk 的相册中。
同时,此方法还可以使您获取到处理后的照片的其他属性,比如拍摄时间、文件长宽等,具体可以参看 ImageSqlInfo 类的API。
随后您可以在所设置的组件注释的方法中,按照提示写出回调方法将 result ,然后在外部使用方法接受图片对象。
您需要进行如下设置:
    // 保存到系统相册
    _photoEditMultipleComponent.options.editMultipleOptions.saveToAlbum = NO;
    // 保存到临时文件
    _photoEditMultipleComponent.options.editMultipleOptions.saveToTemp = YES;
该方式将会把处理结果保存到临时文件,同时您也可以设置
    // 控制器关闭后是否自动删除临时文件
    _photoEditMultipleComponent.options.editMultipleOptions.isAutoRemoveTemp = YES;
这样在处理完成之后将会自动删除临时文件。
当上面的配置完成之后,最后不要忘记加上下面的代码打开组件:
    _photoEditMultipleComponent.inputResources = inputResults;
    // 是否在组件执行完成后自动关闭组件 (默认:NO)
    _photoEditMultipleComponent.autoDismissWhenCompelted = YES;
    // 当上一个页面是NavigationController时,是否通过 pushViewController 方式打开编辑器视图 (默认:NO,默认以 presentViewController 方式打开)
    // SDK 内部组件采用了一致的界面设计,会通过 push 方式打开视图。如果用户开启了该选项,在调用时可能会遇到布局不兼容问题,请谨慎处理。
    _photoEditMultipleComponent.autoPushViewController = YES;
    [_photoEditMultipleComponent showComponent];