I would like to display a UIImagePickerController with the allowsEditing property set to true, since that gives you a nice view of the photo that you took with the ability to "Retake" or "Use Photo".
However, I don't want the user to be able to crop the image, so it makes sense to somehow hide that square overlay in that view.
I'm attaching a screenshot for clarification.
UIImagePickerController is a simple-minded lazy way to supply an image-capturing interface. If you adopt it, you must simply accept that. Either you buy into UIImagePickerController for capturing an image or you don’t. If you do, you must accept its limitations.
You can turn off allowsEditing and roll your own interface by removing the default controls and supplying new ones, and you can even push your own secondary interface onto the picker controller (because it is a navigation controller); but you cannot turn on allowsEditing and then struggle against the interface that it gives you.
On the other hand, if you’re willing to do a little work — that is, if you don’t buy into UIImagePickerController — then you simply use AVFoundation to take the photo and build your own interface completely from scratch. Now you can have any interface you like.
Related
Could anybody tell me how I can develop the feature like deposit checks feature in Wells Fargo bank iOS app ? To implement it, should I customize the default UIImagePickerController or AVCaptureSession or something else? the camera function I want looks like the attached screenshot : Wells Fargo iOS app - deposit check
I don't need the image processing function ,just want to know how to customize the camera view like this.
It depends on the functionality you need.
You can customize the UIImagePickerController interface. In the image capture interface, you can hide the standard controls by setting shows- CameraControls to false, replacing them with your own overlay view, which you supply as the value of the cameraOverlayView. If it is all you need UIPickerImagePickerController might be all you need.
But you should probably consider getting rid of UIImagePickerController altogether and designing your own image capture interface from scratch, based around AV Foundation and AVCaptureSession. You get no help with interface, but you get vastly more detailed control than UIImagePickerController can give you. For example, for stills, you can control focus and exposure directly and independently and so on.
As explained here I would need to modify a little the actions/behaviour of the buttons listed in titled. I would like to avoid to build a new image picker overlay as some posts suggest. I just need to add a call to one of my methods into default actions. Isn't there a simple way to do this?
You can't.
As explained in the UIImagePickerController class reference:
The UIImagePickerController class manages customizable,
system-supplied user interfaces for taking pictures and movies on
supported devices, and for choosing saved images and movies for use in
your app. An image picker controller manages user interactions and
delivers the results of those interactions to a delegate object.
And then:
To perform fully-customized image or movie capture, instead use the AV
Foundation framework as described in Media Capture and Access to
Camera.
I'm wondering how I can add the default Library picker button that can be found on an iPhone's default Camera app(can also be accessed via dashboard). The button looks like this, though this is an app custom implementation:
So I know that it can be done, but how? It's the library image picker that you can see the taxi car in. I'm using a completely customized UIImagePickerController through the use of the imagePickerController's property customOverlay view and I need to add this very same button to my overlayView. If someone could guide me towards a solution that'd be of great help, thanks!
I can imagine using UIImagePickerControllerSourceTypePhotoLibrary for the button and simply setting the button's imageView property to the first picture in the camera roll, but how would I go about doing this?
Also, is this somehow controllable by iOS default UIImagePickerController
Maybe this is the wrong place for this (if so, please help guide me where I should ask this). Would it be possible (or even an acceptable iOS practice) to customize:
The screen that shows when a user takes a photo.
The screen that shows when a user accesses their photo library.
Thanks in advance!
Both these screens are provided by the UIImagePickerController class. You can handily customize the screen to take a photo - there's even API for it. You would first set showsCameraControls to NO to prevent the controller from drawing its own controls, then set a value for the cameraOverlayView property to insert your own controls over the camera. Take a look at the UIImagePickerController docs for more.
By contrast, you should not customize the photo library picker - that's a more traditional navigation interface, and Apple hasn't exposed any extra API to customize how it appears. You could (of course) always start poking into the view hierarchy of the controller once it's onscreen, but I think that would be a little more startling to your users than customizing the camera, and is more prone to break if Apple changes the guts of UIImagePickerController.
I'd like to avoid the use/retry view after the picture is taken without disabling the default Apple camera controls that let me take the picture.
Doing this:
imagePicker.showsCameraControls = NO;
Causes ALL the camera controls to disappear. Is there any other method?
Unfortunately there is no proper way to do this provided by Apple. So here are you options:
showCameraControls = NO and adding your own controls.
go hardcore and use AVFoundation - but again you'll need your own controls - probably not what you're looking to do but if you're interested I have a sample app of this here:
https://github.com/Shein/CameraFeedUnderlay
Hack around it - place YOUR OWN button on top of camera control play button and override the action to take the picture as you would without camera controls and directly dismiss the UIImagePickerController.
There's a sort-of example of this solution here:
iPhone SDK - How to disable the picture preview in UIImagePickerController?
Perhaps this helps. You can use imagePicker.showsCameraControls = YES; in collaboration with NSNotificationCenter listening to #"_UIImagePickerControllerUserDidCaptureItem" and #"_UIImagePickerControllerUserDidRejectItem".
When entering the #"_UIImagePickerControllerUserDidCaptureItem" state, you could then dismiss the UIImagePickerController.
I had a similar problem, hiding a overlay when entering the preview view. I could solve the problem with this approach.
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.
from this you can create your own customCameraView to show your own controls that you need to show