更新:的UIImagePickerController [takepicture]模式視野中消失無委託回調
這已經回答了。這是我自己的愚蠢,可能不值得再讀這個問題。大聲笑。
問:
右,所以我有這樣的UIViewController(主)子類,它具有的UIImagePickerController(攝像頭),它也有一個UIView(OverlayView的)。主設置相機配置爲只有自定義cameraOverlay相機,隱藏自定義控件e.t.c.
除了當我嘗試以編程方式拍攝照片時,所有顯示都可以正常工作。會發生什麼是overlayView調用主人,這觸發拍攝圖片,然後我聽到快門聲和虹膜關閉,相機似乎dismiss自己(我敢肯定沒有這樣做在我的代碼),然後我的viewDidAppear被調用我的主人再次。
任何人都有什麼想法發生了什麼?
-(void)viewDidLoad
{
NSLog(@"loading the view");
//if the camera is on the device
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
//make one
camera = [[UIImagePickerController alloc] init];
//setup some settings that we need
camera.sourceType = UIImagePickerControllerSourceTypeCamera;
camera.showsCameraControls = NO;
camera.navigationBarHidden = NO;
camera.toolbarHidden = YES;
camera.cameraViewTransform = CGAffineTransformScale(camera.cameraViewTransform, 1.03, 1.03);
//show it
overlayView = [[OverlayView alloc] initWithFrame:CGRectMake(0,0,320,480) withDelegate:self andController:self];
camera.cameraOverlayView = overlayView;
camerashowing=NO;
}
else
{
alert = [[UIAlertView alloc] initWithTitle:@"No Camera Detected" message:@"The camera is broken or your device has no camera. Please close the application" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
}
-(void)viewDidAppear:(BOOL)animated
{
if (!cameraShowing)
{
NSLog(@"going to show camera");
[self presentModalViewController:camera animated:NO];
camerashowing = YES;
}
}
-(void)releaseShutter
{
[overlayView toolbarShowWarning];
NSLog(@"going to show camera: %@", self);
[camera takePicture];
}
在一些人的幫助建議後,我可以說相機沒有被釋放。
我也設法通過檢查viewDidAppear方法中的bool值來阻止exec_bad_access第二次調用[presentmodal ....]。
我仍然有模態視圖消失,任何幫助,再次大聲笑的問題??
請張貼一些代碼。 – Kobski
你有exec_bad_access的堆棧跟蹤嗎? – rein