7

Want to provide only square photo capture option from our app. Right now with the below code its giving square crop option after capturing. But want it to be exactly like default camera square option. Also we don't want to show anything other than square.

Below is the code we are using.

UIImagePickerController *controller = [[UIImagePickerController alloc] init];
       controller.sourceType = UIImagePickerControllerSourceTypeCamera;
       controller.allowsEditing = YES;
       controller.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
      // controller.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera];
       controller.delegate = self;
       [self.navigationController presentViewController: controller animated: YES completion: nil];

Attached the screen shot

  1. This is our app We are getting this

  2. We want it to be like this. Want it to be like this with only square option

Madhu V Swamy
  • 263
  • 2
  • 14

2 Answers2

0

set allowEditing to YES. from the result dict use the key UIImagePickerControllerEditedImage

then you will have the squared image.

i find no way to let the user select, which format he want :(

Shubham Narang
  • 514
  • 2
  • 14
0

as Shubham Narang has mention, use UIImagePickerControllerEditedImage in imagePickerController:didFinishPickingMediaWithInfo method.

UIImage *originalImage =  (UIImage *) [info objectForKey:UIImagePickerControllerEditedImage];

if(!originalImage)
{
    originalImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
}

This code will use original image if edited (cropped) image doesn't exist