I'm trying to take the UIImagePickerController set to UIImagePickerControllerSourceTypeCamera (ie when it allows the user to take a picture) and push it on my own UINavigationalController but it doesn't work (can't push a UINavigationalController onto another UINavigationalController).
I'm wondering, is there anyway to make a custom version of this camera module, much like you can do with the UIImagePickerControllerSourceTypePhotoLibrary UIImagePickerController using ALAssets? I'd just like to not have to pop up the camera as a modal view and would like to push it on my own UINavigationalController.
You can custom camera using AVFoundation.
Refer Sample AVCam for how to use AVFoundation for it.
Your main issue is that the UIImagePickerController is itself a UINavigationController, so pushing that onto a navigation controller is going to have problems (as you've already found)
As Prince has mentioned, your best bet is to use the AVFoundation to create your own. The downside is you'll (by default) lose the nice features of the camera app such as touch to focus, pinch to zoom etc. but these can all be added yourself.
Check out this tutorial which gives you a nice explanation on how to use the AVFoundation library for this, and also shows you how to add things like an overlay to the camera screen. Then you can easily find on google/stackoverflow how to add things like tap to focus :)
Related
The iPhone camera toolbar holds the following buttons: cancel/record
I would like to change the cancel button to the small image button that takes me to the photo library.
I wasn't sure if i need to use the overlay or does the xcode have something more comfortable in this case since this is something well known and used.
Is there something like this?
Thanks,
You can set overlayView to your UIImagePickerController
imagePicker.cameraOverlayView = yourOverlayView;
UIImagePickerController Class Reference
You can customize an image picker controller to manage user interactions yourself. To do this, provide an overlay view containing the controls you want to display, and use the methods described in “Capturing Still Images or Movies.” You can display your custom overlay view in addition to, or instead of, the default controls. Custom overlay views for the UIImagePickerController class are available in iOS 3.1 and later by way of the cameraOverlayView property. For a code example, see the PhotoPicker sample code project.
I would have though that the UIImagePickerController would allow you to use the camera or choose from the library from within the view? It seems I have to pick one or the other cia the sourceType? Is there no way to add a button to the choose library view to switch to camera?
You would have to implement this yourself. You can make a simple UISegmentedControl and when the value is changed, you change the source of the UIImagePickerController.
I'm new to iOS developement... I want to add 3 buttons on this view: cancel, choose from library and take from camera.
I already know the UIImagePicker method.
Thanks
Ciao Davide, reading UIImagePickerController Class Reference should be useful:
You can customize an image picker controller to manage user interactions yourself. To do this, provide an overlay view containing
the controls you want to display, and use the methods described in
“Capturing Still Images or Movies.” You can display your custom
overlay view in addition to, or instead of, the default controls.
Custom overlay views for the UIImagePickerController class are
available in iOS 3.1 and later by way of the cameraOverlayView
property. For a code example, see the PhotoPicker sample code
project.
Here there is UIImagePickerController Class Reference:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
And here there is PhotoPicker sample code:
http://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010196
I want to hide animation that shows shutter opening while presenting UIImagePickerController to take picture. I checked this question for the same which contains the accepted but I was unable to replicate that functionality in my controller.
I gave overlayView as self.view and when I hide PLCameraView it shows blank white portion and than I am able to take picture. Is there any way to remove that white portion ?
IF needed I can post my full sourcecode project...
Can some body please highlight how to do this ?
Edit:
What I want to do is based on certain event and conditions I want to place image taken from camera or default image in db. And picture taking doesn't involve user interaction so I put NSTimer and take snapshot with the help of takePicture method.
Any thoughts ?
Instead of messing about with the view hierarchy of UIImagePickerController (which you are forcefully warned against in the docs) you should probably use AVCaptureSession and create your own ImagePicker to capture raw images from the video feed.
See http://developer.apple.com/library/ios/#samplecode/AVCam/Listings/Classes_AVCamCaptureManager_m.html for hints.
I'm trying to make an augmented reality application with a waypoint structure, like Yelp, and I'm wondering how to set up my main view so that it displays the camera view on the whole screen. I've heard of using the UIImagePickerController Class, but I'm unsure how to manipulate the code so that it doesn't actually take a picture, but just stays in the view mode. Any help would be appreciated, thanks!
From the documentation:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
You should just be able to create a UIImagePickerController and set sourceType to UIImagePickerControllerSourceTypeCamera, and then disable the camera controls using showsCameraControls.