怎样把视频存到《iPhone i pc蛋蛋200赢到2万》相册

// 官方提供的说明
(void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void
*)contextI
UIKIT_EXTERN void UIImageWriteToSavedPhotosAlbum(UIImage
*image, id completionTarget, SEL completionSelector, void *contextInfo);
(void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error
contextInfo:(void *)contextI
UIKIT_EXTERN void UISaveVideoAtPathToSavedPhotosAlbum(NSString
*videoPath, id completionTarget, SEL completionSelector, void *contextInfo) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_1);
---------------------------------------------------------------------------
#pragma mark -
#pragma mark - 存储图片或视频到相册的通知
@protocol SavedToPhotosAlbumDelegate
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError
*)error contextInfo:(void *) contextI&
- (void)videoSavedToPhotosAlbum:(NSString *)videoPath didFinishSavingWithError:(NSError
*)error contextInfo:(void *)contextI
---------------------------------------------------------------------------
// 调用保存的时候直接调用这个
UIImageWriteToSavedPhotosAlbum(image,
self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:),
// 保存图片到相册
+ (void) writeImageToPhotosAlbumByImage:(UIImage
*) v_image andCompletionTarget:(id) v_target andCompletionSelector:(SEL) v_selector andContextInfo:(void*) v_context {
&&&&UIImageWriteToSavedPhotosAlbum(v_image,
v_target, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:),
v_context);
// 保存视频到相册
+ (void) writeVideoToPhotosAlbumByVideoPath:(NSString
*) v_strVideoPath andCompletionTarget:(id) v_target andCompletionSelector:(SEL) v_selector andContextInfo:(void*) v_context {
&&&&UISaveVideoAtPathToSavedPhotosAlbum(v_strVideoPath,
v_target, @selector(videoSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:),
v_context);
---------------------------------------------------------------------------
// 图片存放到相册后的通知
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError
*)error contextInfo:(void *) contextInfo { &
&&&&NSString
&&&&NSString
(!error) { &
&&&&&&&&title
= @&Success&; &
&&&&&&&&message
= @&Save album success!&; &
&&&&&&&&title
= @&Failure&; &
#if DEBUG_MODE
&&&&&&&&message
= [error description];
&&&&&&&&message
= @&Failed to save the album!&;
&&&&UIAlertView
*alert = [[UIAlertView alloc] initWithTitle:title &
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&message:message
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&delegate:nil
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&cancelButtonTitle:@&OK&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&otherButtonTitles:nil];
&&&&[alert
&&&&[alert
release]; &
本文已收录于以下专栏:
相关文章推荐
1.视频导出:UIAlertController *av = [UIAlertController alertControllerWithTitle:@&提示& message:@&您确定要将视频导出...
保存图片:
UIImageWriteToSavedPhotosAlbum(image,
self, @selector(image:didFinishSavingWithError:contex...
存储图片到photo library与存储video到photo library的API差不多,但也有所不同。图片是可以直接把数据写入photo library,而video需要先把数据存到临时文件然...
[iOS]从相册获取以及用相机拍摄视频并缓存到沙盒
Demo:http://download.csdn.net/detail/u49227
从标题很容易发现,本文只是为了...
// 官方提供的说明
//  -
(void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextIn...
UIImage *img0 = [UIImage imageWithContentsOfFile:[CommonTools getPathByfileName:@&hello_0.bmp&]]...
他的最新文章
讲师:王哲涵
讲师:韦玮
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)主题 : 怎么将下载到沙盒的视频保存到相册?
级别: 侠客
UID: 419912
可可豆: 496 CB
威望: 485 点
在线时间: 683(时)
发自: Web Page
来源于&&分类
怎么将下载到沙盒的视频保存到相册?&&&
或者 怎么直接将视频下载到手机相册?
Go be free,但却一直没有Go be free 成功
级别: 侠客
UID: 419912
可可豆: 496 CB
威望: 485 点
在线时间: 683(时)
发自: Web Page
&&&&&&&& 方法一&&&&&&&&UISaveVideoAtPathToSavedPhotosAlbum([filePath path], self, @selector(video:didFinishSavingWithError:contextInfo:), nil);&&&&&&&&&&&&&&&& 方法二&&&&&&&&ALAssetsLibrary *library&&= [[ALAssetsLibrary alloc] init];&&&&&&&&[library writeVideoAtPathToSavedPhotosAlbum:filePath&&completionBlock:^(NSURL *assetURL, NSError *error) {&&&&&&&&&&&&if (error) {&&&&&&&&&&&&&&&&NSLog(@&Save video fail:%@&,error);&&&&&&&&&&&&} else {&&&&&&&&&&&&&&&&NSLog(@&Save video succeed.&);&&&&&&&&&&&&&&&&NSFileManager *fileManger = [[NSFileManager alloc] init];&&&&&&&&&&&&&&&&[fileManger removeItemAtURL:filePath error:nil];&&&&&&&&&&&&&&&&[ProgressHUD dismiss];&&&&&&&&&&&&}&&&&&&&&}];&&&&&&&&}];
Go be free,但却一直没有Go be free 成功
级别: 骑士
UID: 450994
可可豆: 2636 CB
威望: 1620 点
在线时间: 1005(时)
发自: Web Page
回 1楼(panda_bamboo) 的帖子
建議用第一種,第二種等最低版本到iOS9後就不能用了,
级别: 侠客
UID: 419912
可可豆: 496 CB
威望: 485 点
在线时间: 683(时)
发自: Web Page
回 2楼(bearnewboy) 的帖子
谢谢指点迷津,我用的第二种,看来 要 改过来了!
Go be free,但却一直没有Go be free 成功
级别: 新手上路
可可豆: 22 CB
威望: 22 点
在线时间: 175(时)
发自: Web Page
回 3楼(panda_bamboo) 的帖子
为什么我用这个方法导入沙盒视频的路径,相册中找不到视频呢?
级别: 新手上路
可可豆: 2 CB
威望: 2 点
在线时间: 80(时)
发自: Web Page
回 4楼(哥只是个菜鸟) 的帖子
请问解决了么,我遇到了一样的问题
级别: 新手上路
可可豆: 22 CB
威望: 22 点
在线时间: 175(时)
发自: Web Page
回 5楼(小吃货) 的帖子
&&if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(video_path)) {&&&&&&&&&&&&&&&&UISaveVideoAtPathToSavedPhotosAlbum(video_path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);&&&&&&&&&&&&}这种方法先判断视频格式是否支持导入相册,不支持会打印提示
关注本帖(如果有新回复会站内信通知您)
发帖、回帖都会得到可观的积分奖励。
按"Ctrl+Enter"直接提交
关注CocoaChina
关注微信 每日推荐
扫一扫 关注CVP公众号
扫一扫 浏览移动版博客分类:
UIImage *img = [UIImage imageNamed:@"daziran.jpg"];
// 保存图片到相册中
UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
当保存完成后,调用的回调方法:
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
// Was there an error?
if (error != NULL)
// Show error message…
NSLog(@"Save image failed");
// No errors
// Show message image successfully saved
NSLog(@"Save image successful");
存视频到相册:
NSString *path=[[NSBundle mainBundle] pathForResource:@"movie" ofType:@"mp4"];
if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path))
UISaveVideoAtPathToSavedPhotosAlbum(path,nil,nil,nil);
NSLog(@"no available");
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:@"no available" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
[alert show];
[alert release];
相关知识库:
浏览: 57844 次
来自: 深圳
为啥没有显示出来
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'iPhone拍摄后存放相册里的视频(或照片)是什么格式的? - 知乎8被浏览23638分享邀请回答0添加评论分享收藏感谢收起}

我要回帖

更多关于 pc蛋蛋200赢到2万 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信