[英]iPhone Camera Overlay issue
我在iPhone應用程序中使用相機的自定義疊加層,我已經按照本教程進行操作。 我的問題是-覆蓋物在快門打開之前就出現了,意味着快門用戶可以看到覆蓋物(按鈕,圖像等)
我嘗試過使用計時器,以在快門打開動畫的時間上延遲疊加外觀,但這不是正確的方法。
有更好的主意嗎?
-(void)onShowCam
{
NSLog(@"sdadas");
overlay = [[CustomOverlayView alloc]
initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
overlay.delegate = self;
.....
嘗試使用這個
cameraOverlay=[[ImagePickerController alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate=self;
imagePicker.showsCameraControls=NO;
imagePicker.cameraFlashMode=UIImagePickerControllerCameraFlashModeOff;
[imagePicker setCameraOverlayView:cameraOverlay];
//Show camera
[self presentModalViewController:imagePicker animated:YES];
在iPad上,此問題不存在,並且默認情況下,疊加視圖位於快門動畫之后。 但是在iPhone上,疊加層顯示在前面。
我找到了適合我的解決方案。
您必須使用此方法將疊加視圖設置為子視圖:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (!viewController)
return;
UIView* controllerViewHolder = viewController.view;
UIView* controllerCameraView = [[controllerViewHolder subviews] objectAtIndex:0];
UIView* controllerPreview = [[controllerCameraView subviews] objectAtIndex:0];
[controllerCameraView insertSubview:self.overlayView aboveSubview:controllerPreview];
}
希望能幫助到你
原始來源: http : //www.alexcurylo.com/blog/2009/06/18/uiimagepickercontroller-in-3-0/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.