简体   繁体   English

禁用重拍,播放和使用视频屏幕UIImagePickerController

[英]Disable the retake, play and use video screen UIImagePickerController

I am just wanting one screeen: 我只是想要一个人: 在此输入图像描述 When using the UIImagePickerController it uses two screens. 使用UIImagePickerController它使用两个屏幕。

But I don't want this one: 但我不想要这个:

在此输入图像描述

Is this possible? 这可能吗?

@Fahri is right AVFoundation is more flexible but if you want to stick with UIImagePickerController what you could do is turn off the camera control by setting showsCameraControls property to NO , then present your own view and custom methods. @Fahri是对的AVFoundation更灵活但是如果你想坚持使用UIImagePickerController你可以做的是通过将showsCameraControls属性设置为NO来关闭相机控件,然后呈现你自己的视图和自定义方法。

Change your code to: 将您的代码更改为:

takeVideo takeVideo

- (IBAction)takeVideo:(UIButton *)sender {

    UIToolbar *toolBar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-54, self.view.frame.size.width, 55)];

    toolBar.barStyle =  UIBarStyleBlackOpaque;
    NSArray *items=[NSArray arrayWithObjects:
                    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel  target:self action:@selector(cancelVideo)],
                    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace  target:nil action:nil],
                    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera  target:self action:@selector(shootVideo)],
                    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace  target:nil action:nil],
                    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace  target:nil action:nil],
                    nil];
    [toolBar setItems:items];

    // create the overlay view
    UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-44)];
    overlayView.opaque=NO;
    overlayView.backgroundColor=[UIColor clearColor];

    // parent view for our overlay
    UIView *cameraView=[[UIView alloc] initWithFrame:self.view.bounds];
    [cameraView addSubview:overlayView];
    [cameraView addSubview:toolBar];

    picker = [[UIImagePickerController alloc] init];

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO){
        NSLog(@"Camera not available");
        return;
    }

    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
    picker.delegate = self;

    // hide the camera controls
    picker.showsCameraControls=NO;
    [picker setCameraOverlayView:cameraView];

    [self presentViewController:picker animated:YES completion:nil];

}

shootVideo shootVideo

-(void) shootVideo {
    [picker startVideoCapture];
}

cancelVideo cancelVideo

- (IBAction)cancelVideo {
    [self dismissViewControllerAnimated:YES completion:nil];
}

screenshot 截图

在此输入图像描述

DOWNLOAD DEMO PROJECT 下载演示项目

If you have already checked the documentation of UIImagePickerController before posting your question, then you can use AVFoundation library to build your own camera controller, with any controls and screens you want. 如果您在发布问题之前已经检查过UIImagePickerController的文档,那么您可以使用AVFoundation库来构建您自己的相机控制器,以及您想要的任何控件和屏幕。 Good Luck! 祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有覆盖的iOS 7 UIImagePickerController - 重新拍摄并使用不可用的照片 - iOS 7 UIImagePickerController with Overlay - retake and use photo not usable 使用UIImagePickerController自定义“使用”,“取消”,“重拍”和“倒车”按钮事件 - Custom “Use”, “Cancel”,“Retake” and “Reverse Camera” button event using UIImagePickerController UIImagePickerController 使用照片/重拍按钮不起作用 - UIImagePickerController Use Photo / Retake buttons don't work 如何在UIImagePickerController中访问“Retake”选项? - How to access “Retake” option in UIImagePickerController? 替换拍摄并重新拍摄按钮UIImagePickerController - Replace shoot and retake button UIImagePickerController 如何在 UIImagePickerController 中禁用视频捕获 - How to disable video capture in UIImagePickerController 视频预览屏幕冻结UIImagePickerController - Video preview screen freezes UIImagePickerController UIImagePickerController在UpperCase Letters“USE_PHOTO”,“RETAKE”和Gallery Images“CAMERA_ROLL”中显示文本? - UIImagePickerController shows text in UpperCase Letters “USE_PHOTO” , “RETAKE” and Gallery Images “CAMERA_ROLL”? Swift:如何更改UIImagePickerController的“使用照片”,“取消”,“拍摄”,“重拍”按钮的默认行为 - Swift: how to change default behaviour of buttons “Use Photo”, “Cancel”, “Shoot”, “Retake” of UIImagePickerController 是否可以更改UIImagePickerController ..即(取消,使用,重拍等)的UIButton的动作? - is it possible to change the actions of the UIButtons for the UIImagePickerController.. i.e.(cancel, use, retake..etc…)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM