I'm using a UIImagePickerController
set up as a camera with an overlay view.
I want to present a modal view controller on top on this. When I do so, though, the camera view "closes". This would be okay, but when I dismissModalViewControllerAnimated, I see the closed camera, and there is a long and annoying delay before it reopens. I would like to avoid this.
Unless someone has a better approach, I am planning to si开发者_Go百科mply perform the transition that presentModalViewController
would perform myself. However, if I take my modal view from it's controller and add it as a sub view of the camera overlay view, like this:
[[_imagePickerController cameraOverlayView] addSubview: [viewController view]];
then the modal view doesn't show up at all, and the application crashes with an EXC_BAD_ACCESS
in my "modal" view's layoutSubViews.
Where as, if I present it with presentModalViewController
, everything works fine. Clearly, presentModalViewController
is also doing some other stuff. Does anyone know what this is so that I can recreate it?
Wow – don't I feel like a shmuck.
The deeply mysterious, intricate ingredient, in "presentModalViewController:" that I was missing is to retain the view controller being presented. Doah! I wasn't, so it was crashing when the view (a table view) accessed the controller to look up it's cells.
Other than that, it's pretty easy to roll your own present equivalent. Good link here:
http://dmunsie.wordpress.com/2009/08/07/custom-animations-between-uiviewcontrollers/
– I think what the code does (a cross fade) can be done simply with the usual "present…" call, by specifying a "UIModalTransitionStyleCrossDissolve", but it does illustrate what's going on behind the scenes.
Maybe this will help someone :-)
精彩评论