Rotate MPMoviePlayerViewController while app is in Portrait mode - ios

how can I autorotate MPMoviePlayerViewController according to the current mode, while the whole app is set to only portrait mode?

If your base SDK is iOS 6, you can't. The whole app (in the target summary pane = the info.plist) must be set to include all orientations that any part of your app will ever be willing to accept. You then filter out unwanted orientations from any parts of the app that should not be allowed to rotate to all of those orientations, e.g. with supportedInterfaceOrientations.

Related

How to make iOS app orientation portrait only?

How do I make my iOS app Portrait Only? It looks like it's already in portrait mode currently but when I flip my device it rotates still. I am using tableViews and collectionViews within my app, I'm not sure if they would affect these settings or not.
To fix this problem I had to add "Supported interface orientations (iPhone)" and set the item to "Portrait (bottom home button)" in my info.plist file

How do you launch an iOS app in the current device orientation?

I'm working with Xamarin and am having troubles launching my app in the current device orientation.
I have a UINavigationController that I set on my main UIWindow as the root controller. I created a custom UINavigationController which overrides the methods :
GetSupportedInterfaceOrientations
and
ViewWillTransitionToSize
If I hold my iPad in landscape mode and start the app, it will start in portrait mode and then rotate in landscape. I'd like to make it start in the same orientation as the device's physical orientation. From the doc I've read it seems that since iOS 8, everything related to rotations should be handled in the root uiview controller which is my custom UINavigationController.
And here's my problem... let's say I want to start my app in the current device's orientation and then block everything except Portrait once the app is loaded. I tried the 2 following solutions and none worked.
1- I put all interface orientations available in the supported interface orientations key in the info.plist file. I launched the app while holding the iPad in landscape mode. In this case, my app starts in the same orientation as the device which is cool. What is not cool is that it doesn't call my navigation controller method GetSupportedInterfaceOrientations anymore. So even if I change the return value of that method to Portrait only later one, it does absolutely nothing since the method is never called anymore.
2- I removed all supported interface orientations from the info.plist file. I lauched the app while holding the iPad in landscape mode. In this case, my app starts in portrait mode and then rotates to landscape. I want to prevent the rotation and just start the app in the current device's orientation (landscape). With this setup though, I can later change the supported orientation as the navigation controller method GetSupportedInterfaceOrientations is being called everytime we try to rotate the app.
In apple's doc, it says "At launch time, apps should always set up their interface in a portrait orientation. After the application (_:didFinishLaunchingWithOptions:) method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window."
The part where the view rotates to the appropriate orientation PRIOR to showing the window doesn't seem to work for me. It shows the window and then rotates it after.
So how do you launch an app in the current device's orientation (without the user seeing your first view rotate from portrait to whatever) and then be able to change the supported orientations later in the app? Example : I hold my iPad in landscape mode. I launch my app. First view I see is already in landscape mode. I can then rotate my iPad to change the view in portrait/landscape back and forth. Then I click a button which changes the supported orientation to Portrait which prevents me from changing the orientation to Landscape anymore.
Thanks!

Force orientation and disable rotation based on device at App Delegate level?

I have a universal app for iPhone and iPad. I would like to restrict the orientation of my app to only portrait on the iPhone (for all views) and only landscape on the iPad (for all views). In addition to this, I'd like to disable orientation change / autorotate.
I'd like to enforce / set these requirements at an application / app delegate level and not on a per viewcontroller level.
Any help would be appreciated!
The info.plist keys for supported orientations have separate entries for iPhone and iPad. You can set those up to control the settings app-wide.

Universal app and landscape orientation for iPad

I want to design a universal app that I'd want to support just portrait orientation. It's weird because Xcode allows you to select portrait orientation only in the target's Deployment Info settings (and in Info.plist), but reading the iOS Human Interface Guidelines, in the section regarding the launch images, I've found this:
You must provide at least one launch image. Typically, an iPhone app includes at least one launch image in portrait orientation; an iPad app includes at least one launch image in portrait orientation and at least one launch image in landscape orientation.
Does that mean that you have to provide a launch image in landscape orientation even if you only support portrait orientation? Or is it required to support landscape orientation in iPad?
Thanks
EDIT: It looks like it is not required to support both portrait and landscape orientations in iPad, though strongly recommended. However, it looks like, if an orientation supported, also the opposite one should be (portrait and upside-down, for instance). Is it required then to provide both launch images? (portrait and upside-down). Thanks again
It is strongly recommended that your application support all orientations. This includes portrait, portrait upside-down, landscape left and landscape right. iPad apps that require an orientation must support both variants of that orientation.
https://developer.apple.com/library/ios/qa/qa1588/_index.html

Is there a way to start iOS app with the initial orientation dynamically?

I know that we can define main orientation in iOS apps. However I couldn't figure out a way to do what I want: If the device is in landscape mode, start the whole application in landscape mode. If not, start it in portrait.
Currently, if I start the application after rotating the device into landscape mode, It opens in portrait mode than it rotates. Is there a way to start the whole app in landscape? (Already rotated window)
Yes; just indicate that you support all device orientations in your info.plist. You can see this in Xcode in your project settings under "General" in Xcode 5.
Quote from Apple's UIViewController documentation:
Note: At launch time, apps should always set up their interface in a portrait orientation. After the application:didFinishLaunchingWithOptions: method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.

Resources