代码之家  ›  专栏  ›  技术社区  ›  neha

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

  •  3
  • neha  · 技术社区  · 14 年前

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

    1. 拍照

    我在代理方法-imagePickerController:didFinishPickingImage editingInfo:中的modalViewController中演示这张照片,方法是创建一个带有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];
       }
    

    我真的被困在这里了。

    提前告诉他。

    1 回复  |  直到 14 年前
        1
  •  3
  •   Manjunath    14 年前

    在展示modalViewcontroller之前,请隐藏状态栏,然后再试一次。