2

Is there any good way to set UIImagePicker to landscape orientation? I tried to call setStatusBarOrientation after presentModalViewController like following,

[self presentModalViewController:picker animated:YES];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];

However, the video duration view (00:00) on the right corner didn't rotate as orientation changed.

DShah
  • 9,632
  • 11
  • 68
  • 126
0pcl
  • 1,164
  • 3
  • 17
  • 22

3 Answers3

4

Unfortunately, according to the documentation, the image picker only supports portrait mode.

David Maymudes
  • 5,659
  • 30
  • 34
1

Apple doesn't support landscape for camera view. If you want anything shown as customised then add overlay view on it & transform that view to look as landscape view. @Note:-overlay is also add as portrait thats why transformation needed.

Ameer
  • 625
  • 7
  • 17
1

I was able to create landscape camera view using the following code:

[self.view insertSubview:self.imagePicker.view atIndex:0];

self.imagePicker.view.transform =  
    CGAffineTransformScale (
                            CGAffineTransformTranslate(
                            CGAffineTransformMakeRotation(M_PI/2), -90, -15),
                            1.2,1.2)
                            ;

Note that I am directly adding the imagePicker's view to the current view, not calling it as a modal.

self.imagePicker.view.transform seems to respond as expected to all CGAffineTransform function calls, though I can't speak to whether or not Apple approves of this method.

Tim Cooper
  • 151,519
  • 37
  • 317
  • 271
deepwinter
  • 4,318
  • 2
  • 30
  • 36