- (BOOL)canHandleAdjustmentData:(PHAdjustmentData *)adjustmentData { // Inspect the adjustmentData to determine whether your extension can work with past edits. // (Typically, you use its formatIdentifier and formatVersion properties to do this.) return NO; } //这个函数用于从系统相册获取到选中的照片,contentEditingInput对象中存有响应的数据类型和image对象 - (void)startContentEditingWithInput:(PHContentEditingInput *)contentEditingInput placeholderImage:(UIImage *)placeholderImage { //我们可以在这里将取到的数据进行展示等等 self.input = contentEditingInput; } //结束编辑照片时的方法 - (void)finishContentEditingWithCompletionHandler:(void (^)(PHContentEditingOutput *))completionHandler { // Update UI to reflect that editing has finished and output is being rendered. // Render and provide output on a background queue. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // Create editing output from the editing input. PHContentEditingOutput *output = [[PHContentEditingOutput alloc] initWithContentEditingInput:self.input]; //我们可以在这里将新的图片数据写入到输出流中 // output.adjustmentData = <#new adjustment data#>; // NSData *renderedJPEGData = <#output JPEG#>; // [renderedJPEGData writeToURL:output.renderedContentURL atomically:YES]; // Call completion handler to commit edit to Photos. completionHandler(output); // Clean up temporary files, etc. }); }