- //接口中定义这个方法,然后在实现类中实现他
- - (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *) contextInfo;
- //实现类中实现
- - (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *) contextInfo {
- NSString *message;
- NSString *title;
- if (!error) {
- title = @"成功提示";
- message = @"成功保存到相";
- } else {
- title = @"失败提示";
- message = [error description];
- }
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
- message:message
- delegate:nil
- cancelButtonTitle:@"知道了"
- otherButtonTitles:nil];
- [alert show];
- [alert release];
- }
- //调用方法保存到相册的代码
- UIImageWriteToSavedPhotosAlbum(img, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), nil);
保存图片到相册
最新推荐文章于 2024-03-01 17:22:45 发布