How to create a custom UIImagePickerController with fullscreen ios images

I have a simple UIImagePickerController that will use the camera to take a snapshot, but there are a few things I would like to do:

  • Camera User Interface
  • Take full-screen mode instead of 480x640 (if on a 4-inch phone)

Here is my code for displaying UIImagePickerController:

- (IBAction)pick:(id)sender { NSLog(@"abc"); picker = [[UIImagePickerController alloc] init]; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [picker setSourceType:UIImagePickerControllerSourceTypeCamera]; } else { [picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; } [picker setDelegate:self]; [self presentViewController:picker animated:YES completion:nil]; } 

and here, when the image is taken:

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissViewControllerAnimated:YES completion:nil]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; [imageView setImage:image]; } 

How to do it?

thanks

+6
source share
1 answer

For the first marker point, I assume that you can use the cameraOverlayView property of the UIImagePickerController to add a user interface to the default interface:

 - (IBAction)pick:(id)sender { NSLog(@"abc"); picker = [[UIImagePickerController alloc] init]; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [picker setSourceType:UIImagePickerControllerSourceTypeCamera]; } else { [picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; } // Add here your custom UI here [picker setCameraOverlayView:self.customCameraOverlayView]; [picker setDelegate:self]; [self presentViewController:picker animated:YES completion:nil]; } 

EDIT

I tested the UIImagePickerController and returns the image with its full dimensions (PixelXDimension and PixelYDimension):

  UIImagePickerControllerMediaMetadata = { DPIHeight = 72; DPIWidth = 72; Orientation = 6; "{Exif}" = { ApertureValue = "2.526068811667588"; BrightnessValue = "-0.5779073354035674"; ColorSpace = 1; DateTimeDigitized = "2013:04:07 22:30:03"; DateTimeOriginal = "2013:04:07 22:30:03"; ExposureMode = 0; ExposureProgram = 2; ExposureTime = "0.05882352941176471"; FNumber = "2.4"; Flash = 24; FocalLenIn35mmFilm = 35; FocalLength = "4.28"; ISOSpeedRatings = ( 800 ); MeteringMode = 3; PixelXDimension = 3264; PixelYDimension = 2448; SceneType = 1; SensingMethod = 2; ShutterSpeedValue = "4.058893689053568"; SubjectArea = ( 1874, 1478, 610, 612 ); WhiteBalance = 0; }; "{TIFF}" = { DateTime = "2013:04:07 22:30:03"; Make = Apple; Model = "iPhone 4S"; Software = "6.1.3"; XResolution = 72; YResolution = 72; }; }; 

EDIT

You can also set the content mode for your image to resize and match the look of the container:

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissViewControllerAnimated:YES completion:nil]; UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; [imageView setContentMode:UIViewContentModeScaleAspectFill]; [imageView setImage:image]; } 

and after that, to fit the imageView as you need, you look at the controller based on the device screen (4 inches or not) using auto layout or auto sizing .

+8
source

All Articles