Is it possible to show UIImagePickerController in iphone in landscape mode? [duplicate] - ios

This question already has answers here:
UIImagePickerController in Landscape
(9 answers)
Force landscape orientation in UIImagePickerController
(3 answers)
Closed 9 years ago.
My application is in Landscape. I am using UIImagePickerController to record a video. But whenever we call the UIImagePickerController, it is coming in portrait mode. I decided to rotate the layout of imagep pickercontroller by usingUIImagePickerController` Subclass.
Through this, image picker controller layout is coming in Landscape. But it is working in iPad only. I tested in iPhone. But it is not working. Layout is not changing exactly in iPad.
Is it possible to show UIImagePickerController in iPhone in landscape mode?
First picture is, I tested in iPad. Second one is, I tested in iPhone.

As per UIImagePickerController class documentation it is not possible:
Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.
But yes you can customize this controller to work as per your requirement.
I think if you change/replace cameraOverlayView(like click button and all) to landscape it'll automatically look like in landscape mode.

Related

How to segue from landscape to portrait orientated view controllers

I'm working on an app that works only in landscape orientation but there's an option to access the photo roll and choose pictures to be used in the app.
This works only in portrait mode.
So I have have to work with 2 view controllers, one that needs to be in portrait mode only and the second that should always be in landscape mode. Does anyone knows how I can accomplish this in Swift?

UIImagePickerController bug Rotate

I use UIImagePickerController in my ViewController(Collection View).
When rotate Device I have some bugs following pictures.
1.Portrait Mode : it's OK.
2.Landscape Mode : it's OK.
3.Select Action Sheet : UIImagePickerController : it's OK.
4.Select Camera Roll : it's auto rotate to Portrait
5.Touch Cancel on Camera Roll : mainViewController auto rotate to Portrait
I want
1) when touch Camera Roll it's show on Landscape mode
2) after touch Cancel and back to mainView , mainView show Landscape
P.S. This Project can Landscape and Portrait, This Problem occur on Landscape ONLY.
Thank you and sorry about my English.
Please read the DOCUMENT it is clearly said that it supports only PORTRAIT MODE
IMPORTANT
The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.
So when you go to photo library it will be in portrait mode and when selected a image or cancelled it will come back to whatever previous mode you had.

iOS Orientation adapts to unapproved device orientation after Camera dismissed

I am currently writing an iOS app in which have the acceptable device orientations set to Landscape Right and Landscape Left, and in all of my view controllers, I’m returning only those two in the supportedInterfaceOrientations method.
However, if the user uses the in-app camera functionality (which is implemented via UIImagePickerController presented modally in full screen) and rotates the device to Portrait orientation to take a picture, the camera rotates to portrait mode (which is fine), and if the user clicks "Use Photo", when the modal view is dismissed, the view from which the camera was launched is somehow now in portrait mode (which is not fine).
After the camera view has been dismissed, the view controller from which it was launched has UIDeviceOrientationIsPortrait set to true. I am wondering how it ended up in this orientation, and how when a picture is taken, I can ensure that the presenting view controller remains in a landscape orientation. Any help is greatly appreciated!
I am currently writing an iOS app in which have the acceptable device
orientations set to Landscape Right and Landscape Left, and in all of
my view controllers, I’m returning only those two in the
supportedInterfaceOrientations method.
In iOS 6 and later, your app supports the interface orientations defined in your app’s Info.plist file
Have you tried setting it here? Then see if the problem still occurs.
Also, if this doesn't work, try setting the supportedInterfaceOrientations values in the viewWillAppear method of the ViewController that launched UIImagePicker?

Rotate view controller

I set my app that it should works only in portrait, now I'm showing a youtube video and I think it's better to see this video in landscape mode. I set my app with this flags:
How I can rotate the view when the video is playing? I display the video I'm using the HCYoutubeParser library. Can you help me?
UPDATE
storyboard:
You should check “Portrait”, "Landscape Left" and "Landscape Right" in the Deployment Info. In the video player view controller, you support Portrait and Landscape, in your other view controllers only support Portrait.
You can refer to Autorotate in iOS 6 has strange behaviour and
iOS 6 UITabBarController supported orientation with current UINavigation controller

Landscape-only IPad App With UISplitViewController

I am almost done developing an app. Right now I'm converting it to a universal app by supporting iPad to supported devices as well.
Can I set the app to use Landscape orientation only, since I am using UISplitViewController and want the Master View Controller to remain on the screen all the time? Is there any Apple policy that states that I cannot restrict it to Landscape only and I have to implement both portrait and landscape? Is there any chance my app can be rejected by setting it to Landscape only for iPad?
Don't worry, you'll be fine. Support both landscape orientations and neither portrait orientation if you want. I've got apps in the store that are like that.
However, note that UISplitViewController does have an option to keep both views on the screen all the time even in portrait. Use the delegate method splitViewController:shouldHideViewController:inOrientation: to forbid hiding the master view:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intf/UISplitViewControllerDelegate
So if your only reason for being landscape only is that you don't want to hide the master view, it is a false reason. Look, for example, at Apple's Settings app, which works like that; it is a split view controller that always shows both views in all four orientations.

Resources