2012-02-06 18 views
1

私の問題は、 デフォルトのカメラコントロールを非表示にし、自分自身でオーバーレイします。これは、cameraOverlayViewプロパティで行われます。 takePictureメソッドのトリガーに問題がありました。cameraOverlayViewで画像を取得

+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)を参照してください。)

OPが書いた:

をここでは解決策になるようになったものです:

私は2つのUIViewControllerを持っています。メインのViewControllerとCustomOverlay(カメラコントロール用)。

私の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のメソッドをトリガーします私はそれを確認したら、上記のすべてのコードはもう少し変更します

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

、cameraSourceTypeがある場合、私がチェックする条件を持っている必要があり、特別に第一ブロック:

とバックメインのViewControllerへ利用可能です。

誰かを助ける希望。質問があれば、ただ聞いてください。

関連する問題