【问题标题】:View shift problem with UIImagePickerController with datasource as UIImagePickerControllerSourceTypeCamera使用数据源作为 UIImagePickerControllerSourceTypeCamera 的 UIImagePickerController 查看移位问题
【发布时间】:2010-07-22 16:25:04
【问题描述】:

在我的应用程序中,我为用户提供了两个上传照片的选项:

  1. 拍照
  2. 从库中选择

我在委托方法中的 modalViewController 中呈现这张照片 - imagePickerController: didFinishPickingImage editingInfo: 通过创建带有 imageview 的 viewController 并在其中加载选定的图像。

使用照片库很好,但是在从相机拍照时,每当我在拍照后在委托方法中启动我的 modalViewController 时,视图都会向下移动近 20 个像素。此后,每当我返回时,所有视图都会发生变化。

编辑:

    - (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];
   }

我真的被困在这里了。

有人可以帮忙吗?这真的很紧急。

提前感谢。

【问题讨论】:

  • 请至少在您的didFinishPickingImage 方法中发布代码。
  • 20像素..这不是状态栏的高度吗??
  • 是的..我不确定如何处理这种转变..我也尝试设置它的框架..

标签: iphone uiimagepickercontroller modalviewcontroller


【解决方案1】:

在展示您的 modalViewcontroller 之前隐藏状态栏并尝试一下。

【讨论】:

  • 再次感谢 Manjunath - 我在 iOS 5 中遇到了与 MGSplitViewController 类似的问题,在从模型 UIImagePickerController 返回时,主视图和详细视图将短 20 像素。在presentModalViewcontroller 之前调用[[UIApplication sharedApplication] setStatusBarHidden:YES];,然后在dismissModalViewControllerAnimated 之前调用setStatusBarHidden:NO 对我来说非常有效!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多