使用UIImagePickerController获取图片和视频

if (isVideo) {
    if (sourceType == UIImagePickerControllerSourceTypeCamera) {
        _cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        _cameraPicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
        _cameraPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, (NSString *)kUTTypeImage, nil];
        _cameraPicker.videoQuality = UIImagePickerControllerQualityType640x480;
        _cameraPicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
    } else {
        _cameraPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        _cameraPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, nil];
    }
} else {
    _cameraPicker.sourceType = sourceType;
    _cameraPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage, nil];
}

你可能感兴趣的:(使用UIImagePickerController获取图片和视频)