I downloaded the AVCam demo from the apple site and tried to add a simple start screen (I added a StartViewController.{h,m,nib}) with a button that would then launch the AVCam demo. The code for the button is as follows (everything else is just the default stuff created by xcode):
-(IBAction) btnClicked:(id) sender {
viewController =
[[AVCamViewController alloc]
initWithNibName: @"AVCamViewController"
bundle:nil];
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp
forView:self.view
cache:YES];
[self.view addSubview:viewController.view];
[UIView commitAnimations];
}
Somehow after adding this nib, taking a photo does not work all the time (sometimes no picture ends up in the camera roll). I added some log statements to captureStillImage in the captureStillImageAsynchronouslyFromConnection:stillImageConnection completionHandler and noticed that this completionHandler does not always get called. Weird thing is that it does work some of the time. My guess is that I'm doing something wrong but not sure what? I'm testing this on an iPhone running 4.2.1.