将手机旋转到横向时,UIImagePickerControllerSourceTypePhotoLibrary会在侧面转向相机

时间:2015-11-28 07:31:57

标签: objective-c ios7 uiimagepickercontroller viewwillappear ios-camera

我是xcode的新手。在我的视图控制器有图像库选项。用户可以选中图像以查看和添加图像。当用户单击添加新图像选项时,其显示弹出窗口有两个选项,如图像和相机。 用户可以添加图库中的图像以及从相机捕获新图像。在这种情况下,我的相机视图工作正常。然后我点击图库视图,图库照片完美显示。但是当我将画廊照片视图旋转到风景时,它会自动进入相机的侧面。这是我的问题..我想当手机在风景中旋转照片库时,它不会侧视摄像机视图。请任何人帮助我。 我的代码在下面

- (void)viewWillAppear:(BOOL)animated {//
[super viewWillAppear:animated];

if (!self.disableGalleryUpdate) {
    //This will replace share button in FSImageViewController share button in navigation bar
    HPLBarButton *barButton = [HPLBarButton barButtonWithImage:AddNewContractor forTarget:self withSelector:@selector(addObject:)];

    self.navigationItem.leftBarButtonItem = barButton;
} else {
    self.navigationItem.leftBarButtonItem = nil;
}
APP_DELEGATE.screenHasMultipleOrientation = YES;
[self.navigationController setNavigationBarHidden:NO];

}

- (void)addImageClicked:(id)sender {
[[HPLImageSourceSelectionDeviceManager device] showImageSourceSelectionInView:self.view
                                                      withGalleryButtonAction:^{[self camera];}
                         cameraButtonActionBlock:^{[self gallery];}
                            ];}





-(void)camera
{
     UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
     picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:YES completion:nil];
} 

 -(void)gallery
{
      UIImagePickerController *picker = [[UIImagePickerController alloc] init];
     picker.delegate = self;
     picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentViewController:picker animated:YES completion:nil];
  }

当我在potrait中选择图片库视图时

enter image description here

和landscpe

E nter image description here

0 个答案:

没有答案
相关问题