简体   繁体   English

使用UIImagePickerControllerSourceTypeCamera查看UIImagePickerController的移位问题,数据源为

[英]View shift problem with UIImagePickerController with datasource as UIImagePickerControllerSourceTypeCamera

In my aplication I'm providing two options for user for uploading photos: 在我的应用中,我为用户上传照片提供了两个选项:

  1. Take a photo 拍张照片
  2. Choose from library 从图书馆选择

I'm presenting this photo in a modalViewController in delegate method - imagePickerController: didFinishPickingImage editingInfo: by creating a viewController with an imageview and loading the selected image in it. 我在委托方法中的modalViewController中呈现此照片 - imagePickerController:didFinishPickingImage editingInfo:通过创建带有imageview的viewController并在其中加载所选图像。

Working with photo library goes fine, but while taking photo from camera, whenever I launch my modalViewController in delegate method after taking the photo, the view shifts down by almost 20 pixels. 使用照片库很顺利,但是在从相机拍摄照片时,每当我拍摄照片后在委托方法中启动我的modalViewController时,视图会向下移动近20个像素。 And thereafter all the views get shifted whenever I navigate 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'm really stuck here. 我真的被困在这里了。

Can anybody please help? 有人可以帮忙吗? This' really urgent. 这'真的很紧急。

Thanx in advance. Thanx提前。

在呈现modalViewcontroller之前隐藏状态栏并尝试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM