I am not able to Hide the iphone Camera shutter opening animation for my app. I am using UIImagePickerController to access iphone camera and using my own overlay controllers. Is there a way to remove the initial shutter(also known as Iris) animation as the camera starts. Thank You
I've messed around with this a bit, but sending various combinations of the view lifecycle methods to the image picker. (viewWillAppear, viewDidAppear, etc.) But I don't remember which ones ended up working.
Using this answer as a starting point, I've finally solved this problem:
NOTE: This is obviously not 3.3.1-compliant.
Listen for the
UINavigationControllerDidShowViewControllerNotification
on yourUIImagePickerController
, and thePLCameraViewIrisAnimationDidEndNotification
globally.Traverse the view hierarchy (starting at the main
UIWindow
) looking for thePLCameraView
. Save the index of the view against the mainUIWindow
, as you'll need it later.Remove the
PLCameraView
from itssuperView
. If desired, insert your own view at global index 0.When the iris animation is finished, remove your view and re-add the
PLCameraView
at its original index.
Hi All,
Sorry for replying getting back so late. I found out the solution for that well I played around with the view hierarchy of the cameraView and added my own layer at the top of everything. The animation took place there and once the shutter was open the top most layer was removed. If someone need any further help with the code please let me know, I will provide with the exact steps and syntax.
-Ankur
Hi Ankur,
I would like to know cameraView hierarchy as you have mentioned. Can you please post the piece of code here. It would be greatly appreciated.
Thanks, Ashish
Hi Ashish,
The below function is called before the camera iris animation starts.
(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { // Here is were I make the camera preview fit the entire screen. // This might violate the "don't change the view hierarchy"-rule. // So I am not sure if it is valid for App Store commitment. // However, the NSLogs are used to // figure out which subview is the actual Camera Preview which turns out // to be the PLPreviewView. (uncomment to se the printouts). // Change it's size to fit the entire screen (and scale it accordingly // to avoid distorted image
/*NSLog(@"WillShowViewController called...");
NSLog(@"VC:view:subviews\n %@\n\n", [[viewController view] subviews]);
NSLog(@"VC:view:PLCameraView:subviews\n %@\n\n", [[[[viewController view] subviews] objectAtIndex: 0] subviews]);
NSLog(@"VC:view:PLCameraView:PLPreviewView:subviews\n %@\n\n", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 0] subviews]); NSLog(@"VC:view:PLCameraView:PLCropOverLay:subviews\n %@\n\n", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 1] subviews]); NSLog(@"VC:view:PLCameraView:UIImageView:subviews\n %@\n\n", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 2] subviews]);
}
In the above function you can go through each layer by using the normal NSMuatableArray syntax like objectAtIndex
hope this might help you.
Regards,
Ankur