max*_*sme 6 objective-c uiimagepickercontroller ios
我只是想要一个人:
 使用时
使用时UIImagePickerController它使用两个屏幕.
但我不想要这个:

这可能吗?
@Fahri是对的AVFoundation是更灵活,但如果你想坚持UIImagePickerController你可以做的是通过设置showsCameraControls属性关闭相机控件NO,然后呈现自己的视图和自定义方法.
将您的代码更改为:
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
-(void) shootVideo {
    [picker startVideoCapture];
}
cancelVideo
- (IBAction)cancelVideo {
    [self dismissViewControllerAnimated:YES completion:nil];
}
截图
