View shift issue with UIImagePickerController with data source as UIImagePickerControllerSourceTypeCamera

In my application, I provide the user with two options for uploading photos:

  • Take a picture
  • Choose from library

I present this photo in modalViewController in the delegate method - imagePickerController: didFinishPickingImage editInfo: by creating a viewController with a view of the image and loading the selected image into it.

The work with the photo library is going well, but when taking photos from the camera, whenever I run my modalViewController in the delegate method after shooting, the view shifts by almost 20 pixels. And after that, all views change when I move back.

EDIT:

    - (void)imagePickerController:(UIImagePickerController *)_picker1_ didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {

imageUploadView = [[UIViewController alloc]initWithNibName:nil bundle:nil];
imageUploadView.view.frame = CGRectMake(0, 0, 320, 480);
[imageUploadView.view setBackgroundColor:[UIColor blackColor]];
imageUploadView.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

image = [[UIImageView alloc]init];
image.frame = CGRectMake(0, 60, 320, 270);


   //I'm Adding different views like toolbar and barbuttons here

[_picker1_ presentModalViewController:imageUploadView animated:YES];

[image setImage:img];
   }

I am really stuck here.

Can anybody help? This is very relevant.

Thanx in advance.

+3
1

modalViewcontroller .

+3

Source: https://habr.com/ru/post/1756019/


All Articles