加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 带摄像头源的UIImagePickerController允许编辑是:视

发布时间:2020-12-14 19:53:51 所属栏目:百科 来源:网络整理
导读:我正在使用UI ImagePickerController来记录sourceType设置为UIImagePickerControllerSourceTypeCamera的视频. 我已将allowEditing设置为true. 在捕获视频后,我使用修剪界面编辑视频并按“使用”,我只返回原始记录而不是修剪版本.我究竟做错了什么? 我正在使
我正在使用UI ImagePickerController来记录sourceType设置为UIImagePickerControllerSourceTypeCamera的视频.

我已将allowEditing设置为true.

在捕获视频后,我使用修剪界面编辑视频并按“使用”,我只返回原始记录而不是修剪版本.我究竟做错了什么?

我正在使用iOS 5.

-(void)shootvideo {
    imagePicker = [[UIImagePickerController alloc] init];
    [imagePicker.view addSubview:test];
    [imagePicker.view addSubview:test2];

    imagePicker.delegate = self;
    imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;

    imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie,nil];
    imagePicker.showsCameraControls = YES;
    imagePicker.navigationBarHidden = NO;
    imagePicker.toolbarHidden = NO;
    imagePicker.wantsFullScreenLayout = YES;
    imagePicker.allowsEditing=YES;

    [self presentModalViewController:imagePicker animated:YES];
}


-(void) imagePickerController: (UIImagePickerController *) picker
didFinishPickingMediaWithInfo: (NSDictionary *) info 
{
    NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];


    if (CFStringCompare ((__bridge CFStringRef) mediaType,kUTTypeMovie,0)
        == kCFCompareEqualTo) 
    {

        NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

        //NSLog(@"%@",moviePath);

        if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
            UISaveVideoAtPathToSavedPhotosAlbum (moviePath,nil,nil);
        }
    }

    [self dismissModalViewControllerAnimated:YES];  
}

我想根据我的应用程序使用修剪过的视频进行进一步处理.

我哪里错了?

有没有其他方法可以完成这项任务?

解决方法

allowsEditing:一个布尔值,指示是否允许用户编辑选定的静止图像或影片.

@property(nonatomic)BOOL允许编辑

讨论
如果您允许用户编辑静止图像或电影,则代理可能会收到一个字典,其中包含有关所做编辑的信息.委托的协议在UIImagePickerControllerDelegate Protocol Reference.中描述

我认为这会有所帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读