// 官方提供的说明
//
- (void)image:(UIImage *)image didFinishSavingWithError
:(NSError *)error contextInfo:(void *)contextInfo;
UIKIT_EXTERN void UIImageWriteToSavedPhoto
sAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
//
- (void)video:(NSString *)videoPath didFinishSavingWithError
:(NSError *)error contextInfo:(void *)contextInfo;
UIKIT_EXTERN void UISaveVideoAtPathToSaved
PhotosAlbum(NSString *videoPath, id completionTarget, SEL completionSelector, void *contextInfo) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_1);
---------------------------------------------------------------------------
#pragma mark -
#pragma mark - 存储图片或视频到相册的通知
@protocol SavedToPhotosAlbumDelega
te
@optional
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError
:(NSError *)error contextInfo:(void *) contextInfo;
- (void)videoSavedToPhotosAlbum:(NSString *)videoPath didFinishSavingWithError
:(NSError *)error contextInfo:(void *)contextInfo;
@end
---------------------------------------------------------------------------
// 调用保存的时候直接调用这个
UIImageWriteToSavedPhoto
sAlbum(image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError
:contextInfo:), nil);
// 保存图片到相册
+ (void) writeImageToPhotosAlbumB
yImage:(UIImage *) v_image andCompletionTarget:(id) v_target andCompletionSelector:(SEL) v_selector andContextInfo:(void*) v_context {
UIImageWriteToSavedPhoto
sAlbum(v_image, v_target, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError
:contextInfo:), v_context);
}
// 保存视频到相册
+ (void) writeVideoToPhotosAlbumB
yVideoPath:(NSString *) v_strVideoPath andCompletionTarget:(id) v_target andCompletionSelector:(SEL) v_selector andContextInfo:(void*) v_context {
UISaveVideoAtPathToSaved
PhotosAlbum(v_strVideoPath, v_target, @selector(videoSavedToPhotosAlbum:didFinishSavingWithError
:contextInfo:), v_context);
}
---------------------------------------------------------------------------
// 图片存放到相册后的通知
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError
:(NSError *)error contextInfo:(void *) contextInfo {
NSString *message;
NSString *title;
if (!error) {
title = @"Success";
message = @"Save album success!";
} else {
title = @"Failure";
#if DEBUG_MODE
message = [error description];
#else
message = @"Failed to save the album!";
#endif
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
//
UIKIT_EXTERN void UIImageWriteToSavedPhoto
//
UIKIT_EXTERN void UISaveVideoAtPathToSaved
---------------------------------------------------------------------------
#pragma mark -
#pragma mark - 存储图片或视频到相册的通知
@protocol SavedToPhotosAlbumDelega
@optional
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError
- (void)videoSavedToPhotosAlbum:(NSString *)videoPath didFinishSavingWithError
@end
---------------------------------------------------------------------------
// 调用保存的时候直接调用这个
UIImageWriteToSavedPhoto
// 保存图片到相册
+ (void) writeImageToPhotosAlbumB
}
// 保存视频到相册
+ (void) writeVideoToPhotosAlbumB
}
---------------------------------------------------------------------------
// 图片存放到相册后的通知
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError
#if DEBUG_MODE
#else
#endif
}