2012-02-06 6 views
1

내 문제; 기본 카메라 컨트롤을 숨기고 내 카메라 컨트롤로 오버레이합니다. 이 속성은 cameraOverlayView 속성을 통해 이루어집니다. takePicture 메서드를 트리거하는 데 문제가 발생했습니다.카메라에서 사진 찍기 오버뷰보기

+0

그냥 시도해보세요. 만약 당신이 구체적인 문제에 빠지면 여기로 돌아와. – mvds

+0

http://jcuz.wordpress.com/2010/02/17/pickerfocus/ – Sharme

+0

가능한 복제본 [UIImagePickerController : 기본 컨트롤 위에 앉아있는 사용자 정의 카메라 오버레이?] (http://stackoverflow.com/questions/5251336/) uiimagepickercontroller-custom-camera-overlay-on-default-control-on-default-control) –

답변

0

(의견과 편집에 해결 질문 Question with no answers, but issue solved in the comments (or extended in chat)를 참조하십시오.)

영업 쓴 :

나는 두 가지의 UIViewController가 : 여기

는 솔루션으로 온 것입니다. 기본 ViewController 및 CustomOverlay (카메라 컨트롤 용).

I I 소스의 형태와 같은 5 월의 카메라 제어를위한 오버레이 선언의 ViewController : 나는 테이크 사진 버튼이하고 싶은 UIViewController에있는 CustomOverlay, 지금

- (void)viewDidLoad 
{ 
    // notification from the CustomOverlay Controller that triggers the eTakePicture method 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eTakePicture:) name:@"eTakePicture" object:nil]; 

    daysBtn.delegate = self; 
    daysBtn.hidden = YES; 

    picker = [[UIImagePickerController alloc] init]; 
    picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    picker.cameraDevice = UIImagePickerControllerCameraDeviceFront; 
    picker.showsCameraControls = NO; 
    picker.navigationBarHidden = YES; 
    picker.wantsFullScreenLayout = YES; 
    picker.delegate = self; 

    overlay = [[CustomOverlay alloc] initWithNibName:@"CustomOverlay" bundle:nil]; 
    // Overlay for the camera controls, note the "= overlay.view", the ".view" was important 
    // because the overlay is a new UIViewcontroller (with xib) so you have to call the 
    // view. Most tutorials that I saw were based on UIView so only "= overlay" worked. 
    picker.cameraOverlayView = overlay.view; 
    [self presentModalViewController:picker animated:NO]; 

    [super viewDidLoad]; 
} 

- (IBAction)shoot:(id)control { 

    [[NSNotificationCenter defaultCenter] postNotificationName:@"eTakePicture" object:self]; 

} 
:이 버튼 본체의 ViewController의 방법을 트리거

그리고 다시 메인의 ViewController에 :

-(void)eTakePicture:(NSNotification *)notification 
{ 
    [picker takePicture]; 
} 

내가 cameraSourceType가 있는지 확인하는 조건이 있어야 어디 특별히 첫 번째 블록을 그것을 검토하면 모든 위의 코드는 좀 더 변경됩니다 유효한.

누군가가 도움이되기를 바랍니다. 어떤 질문이든 그냥 물어보십시오.