Black view at bottom when using custom camera overlay view (UIImagePickerController) - ios

I want to use custom camera overlay view. Below is the code for it.
imagePicker = [[UIImagePickerController alloc] init];
self.imagePicker.delegate = self;
self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.imagePicker.showsCameraControls = NO;
self.imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
self.imagePicker.toolbarHidden = YES;
self.imagePicker.wantsFullScreenLayout = YES;
self.imagePicker.navigationBarHidden = YES;
self.imagePicker.cameraOverlayView = [self cameraOverlayView];
The issue is there is a black background at bottom and I don't get from where it is coming.
What is wrong in code?

Try cameraViewTransform for full screen.
CGFloat camScaleup = 2;
imagePicker.cameraViewTransform = CGAffineTransformScale(imagePicker.cameraViewTransform, camScaleup, camScaleup);

Related

How to open camera with frame in iOS

How to bound iPhone camera inside a frame like below image.
Let the camera opens on full screen but the reading area will be only non blurred background in short i want to develop a screen shown in image.
I have tried this code but it is not working...
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
picker.showsCameraControls = YES;
picker.navigationBarHidden = YES;
picker.view.frame = CGRectMake(0, 10, 200, 20); // NOT WORKING !!!
picker.toolbarHidden = YES;
picker.wantsFullScreenLayout = NO;
// picker.delegate = delegate;
CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0f, 50.0f);
transform = CGAffineTransformScale(transform, 1.2f, 1.2f);
picker.cameraViewTransform = transform;
[self presentViewController:picker animated:YES completion:nil];
how do i do this?
Thanks in advance!
You have to create custom camera for that. As I can see in the image you need to scan barcode. For that you need to use
AVCaptureSession
AVCaptureVideoPreviewLayer

How to change use video to confirm word in iOS video recording?

We can change of Use Video to Confirm words or other words on iOS video recording?
I think it's not possible to change the text .Since apple is not providing any methods or API to do that . But you can present a overlay view like below:
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;
// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:#"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;
[self presentModalViewController:self.picker animated:NO];
Design Overlay view as per your requirement. You can also use storyboard to design the overlay view and refer that view controller alone .
Since you haven't mentioned the technology using . I have posted the code in Objective C

How to remove that black navigation bar on uiimage pickercontroller

How to remove that black navigation bar on UIimage picker
we use video mode
already write code for hides the navigation bar and camera controls and toolbar
that is
picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsEditing = NO;
picker.showsCameraControls = NO;
picker.cameraViewTransform = CGAffineTransformScale(imagePickerController.cameraViewTransform, 1, 1.32 );
Try this u can sole the issue
picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsEditing = NO;
picker.showsCameraControls = NO;
as possible you can add this code:
picker.wantsFullScreenLayout = YES;

UIImagePickerController dismissing when it shouldn't

I am trying to create a custom camera overlay, but am having some problems. The capture view works great, but I would like to show another view where the user can edit the photo after the image is captured. The problem is that when a photo is taken, the view with the photo is automatically dismissed. How would I fix this so that I can show another view controller after the user takes a photo.
Here is how I create the picker:
self.cameraPicker = [[UIImagePickerController alloc] init];
self.cameraPicker.delegate = self;
self.cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.cameraPicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.cameraPicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.cameraPicker.showsCameraControls = NO;
self.cameraPicker.allowsEditing = YES;
self.cameraPicker.navigationBarHidden = YES;
self.cameraPicker.toolbarHidden = YES;
self.cameraPicker.videoQuality = UIImagePickerControllerQualityTypeIFrame1280x720;
self.frontFacing = NO;
self.gridShowing = NO;
self.showingFlash = NO;
// Insert the overlay
CameraOverlayView *overlay = [[CameraOverlayView alloc] initWithFrame:CGRectMake(0, 0, 320, 568)];
self.cameraPicker.cameraOverlayView = overlay;
overlay.delegate = self;
[self.navigationController presentViewController:(UIViewController *)self.cameraPicker animated:YES completion:nil];
Here is how I take the photo, after this is called, the viewController is dismissed:
, which I do not want:
[self.cameraPicker takePicture];

How to add the UIImagePickerController in the custom view?

How to add the UIImagePickerController in the view ? If I add the image picker to the view, its show on the full screen. I need to show the on the centre of the view, But UIImagePickerController hide the navigation bar.
How add the UIImagePickerController in the view and also show the navigation bar ?
I am using the following code, I got the output like this(screenshot).
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
imagePicker.showsCameraControls = NO;
imagePicker.navigationBarHidden = NO;
imagePicker.toolbarHidden = YES;
imagePicker.wantsFullScreenLayout = NO;
imagePicker.delegate = self;
imagePicker.cameraOverlayView = cameraOverlayView;
[self presentViewController:imagePicker animated:NO completion:nil];
I need some for show the navigation bar while add the UIImagePickerController in the view. Thanks in advance.
If you are develop application for iPad then you can use popoverviewcontroller to show imagepickerviewcontroller with navigation bar
please see thie link :
How to use UIImagePickerController in iPad?
Correct way to customize media capture here using Assets Library.
Simple way (in some cases) is using overlay view with frame size of whole screen and add controls on that view which simulate navigation bar.
if (_pickerOverlay == nil) {
_pickerOverlay = [[UIView alloc] initWithFrame:self.view.bounds];
//red transparent tint for demo
_pickerOverlay.backgroundColor = [UIColor colorWithRed:1.0
green:0.0
blue:0.0 alpha:0.6];
UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeSystem];
btnBack.frame = CGRectMake(20, 20, 250, 40);
[btnBack setTitle:#"Custom buttom" forState:UIControlStateNormal];
btnBack.backgroundColor = [UIColor whiteColor];
[_pickerOverlay addSubview:btnBack];
}
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = NO;
picker.cameraOverlayView = _pickerOverlay;
[self presentViewController:picker animated:YES completion:nil];

Resources