0

I am new to xcode . In my view controller have images gallery option . User can tab the image to view and add the images. When the user click the add new image option , its show popup there two option like image and camera. user can add the images from gallery as well as capture the new images from camera. In the case , my camera view working fine. Then i click the gallery view the gallery photos are shown perfectly. But when i rotate the gallery photos view to the landscape ,its automatically goes to the camera in sideway. This is my problem.. I want to when phone rotate the photos gallery in landscape its not going to camera view sideway. Please any one help me. my code is below

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

When i choose image gallery view in potrait

enter image description here

and landscpe

enter image description here

Milad Faridnia
  • 9,113
  • 13
  • 65
  • 78
roby
  • 1
  • 1

0 Answers0