2011-09-06 2 views
3

detailViewController의 비디오를 530px 너비와 360px 높이로 캡처해야하는 내 ipad 응용 프로그램에 splitviewcontroller을 사용하고 있습니다. 비디오 캡처에 UIImagePickerController을 사용해 보았지만 비디오 캡처 인터페이스의 크기를 변경할 수 없습니다. 앱에서 전체 화면 비디오 캡처를 할 여유가 없습니다. UIImagePickerController의 비디오 캡처 인터페이스 크기를 조정할 수 있습니까? 귀하의 답변에 많은 감사드립니다. 스크린 샷을 추가하지 않아서 죄송합니다. 내 명성이 그것을 허용하지 않습니다.크기 조정 UIImagePickerController 비디오 캡처 인터페이스

답변

2

내가 아는 한 UIImagePickerController를 사용하여 그렇게 할 수 없습니다. 그러나 AVCamCaptureManager 및 AVCamRecorder 클래스를 사용하면 쉽게 수행 할 수 있습니다. 애플은 개발자 사이트 here에 데모 프로그램을 구축했다. AVCam이라고합니다. 간단히 말하면 카메라를 열 때 클릭하면 iPhone의 카메라를 열고 비디오를 녹화하거나 오디오를 캡처하는 클래스와 메서드를 호출합니다. UIImagePickerController에 의해 호출되는 동일한 클래스를 호출합니다.

카메라의 피드를 표시하는 데모 코드에서 작은 UIView 개체를 찾을 수 있습니다. 원하는 크기에 따라보기의 크기를 조정할 수 있으며 카메라의 입력이 많은 영역에 표시됩니다. 카메라의 입력 피드 크기를 조정하고 사진을 캡처하고 싶을 때 저에게 효과적이었습니다. 나는 그것이 당신을 위해서도 잘되기를 바랍니다.

+0

샘플 코드 : \t 엑스 코드 9.0, 아이폰 OS 11.0 SDK **. 고맙습니다. 비디오 프레임을 어떻게 조정했는지 솔루션 코드를 여기에 제공 할 수 있습니까? :) – vaibhav

0

iPad에서 UIImagPickerController 비디오 캡처 인터페이스의 크기를 조정할 수있는 방법을 찾았습니다. 기본 개념은 UIOPopoerController의 차원을 사용하여 UIImagPickerController의 뷰 크기를 조정 한 다음이를 사용자 정의 뷰에 추가하는 것입니다.

//In the following code, videoRecorder is an UIImagPickerController 

//1. Create a container view controller and load UIImagPickerController's view 
UIViewController *containerController = [[UIViewController alloc] init]; 
containerController.contentSizeForViewInPopover = CGSizeMake(320, 240); 
[containerController.view addSubview:videoRecorder.view]; 

//2. Add the container view controller in a UIPopoerController and present the popover outside the visible area on the screen (you can't see it but the popover was presented) 
popoverView = [[UIPopoverController alloc] initWithContentViewController:containerController];      
popoverView.passthroughViews = [NSArray arrayWithObjects:self.view, nil]; 
[popoverView setPopoverContentSize:CGSizeMake(320, 240)]; 
[popoverView presentPopoverFromRect:CGRectMake(0, -1024, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES]; 

//3. Reset the frame of UIImagPickerController's view to meet the frame of its container - this is important to resize the UIImagPickerController's view and must do this step after the popover was presented.          
[videoRecorder.view setFrame:containerController.view.frame]; 

//4. Add the container view controller's view to your custom view - in this example, it is 'camView' with the size 320 x 240 
[camView addSubview:containerController.view]; 

참고 :

자세한 코드 및 설명

은 아래에 나열되어 당신이 비디오 캡처를 완료하거나 취소 할 때, 당신은 팝 오버를 취소하고 사용자 정의보기에서 컨테이너의 뷰를 제거해야합니다. 그들이 요구 사항을 구축 ** 실행되지와 요구에 가장 높은 구성을 제공하고 있습니다

[popoverView dismissPopoverAnimated:YES]; 
[[camView.subviews lastObject] removeFromSuperview];