Actually I develop one iPad application. It works fine as desired. But I have orientation issue when initially application launch. Actually i put iPad flat in landscape(Horizontal) style. Now every time when application launch it will open in portrait mode. I checked with supported orientation style and other things also. I put the log in ViewDidLoad for 3 orientation, 1) viewControllerOrientation - portrait
2) ApplicationStatusbarOrientation - portrait
3) DeviceOrientation - Flat.
Now i have trouble even device is in flat mode (it really put like Horizontal) not in portrait, though why always it open in portrait mode.
Related
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!
The iPhone app should mostly be used in portrait mode, but for two views rotation to landscape is allowed. So in the settings all orientations are allowed and in most views, including the root view, rotation is prohibited. Everything works as expected on iPhone 5 and iPhone 6 plus. On latter even when the app is started from landscape mode: it shows up in portrait mode. But it does not work on the iPad with the iPad's iPhone-emulation-mode ("1x/2x mode"). When I start the app from the desktop in landscape mode it is presented in landscape mode. This is true for ios 7 and ios 8.
Before I post a lot of code, maybe someone has come across this case before and knows a simple solution?
I have an iPhone application who need to run on iOS 7 and iOS 8. It's a full Portrait Application, except for the video player who is displayed thanks to a presented ViewController.
When I start the application from the landscape mode on an iPhone 6 or 6 Plus, It will cause to destroy the HomeView. All the orientation are supported in the project because of the video player (I know I can avoid the problem by removing the landscape support but my video player won't be displayed properly).
So the question is : How can I do to start my application from landscape mode without break the HomeView (so in a nice portrait mode) but at the same time still have my video player properly displayed in landscape mode ?
PS : I can't post screenshots, so when I say "destroy", just imagine the view with not well positioned and scaled elements.
How can I do to start my application from landscape mode without break the HomeView (so in a nice portrait mode) but at the same time still have my video player properly displayed in landscape mode ?
How the application is oriented on launch depends on the order in which the supported orientations are listed in the Info.plist file. Just make sure that Portrait comes first.
How the home view can be oriented depends on the root view controller's implementation of supportedInterfaceOrientation. Make sure that it returns UIInterfaceOrientationMaskPortrait.
In Info.plist set device orientation just to Portrait
In AppDelegate add -
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAll;
}
I am building a word game app for iPad. I want it to run only in Landscape mode.
1. I have enabled only Landscape in plist settings.
2. The rootview controllers view is also set Landscape.
The issue is when I run it on simulator (ios 6.1), it runs in proper Landscape mode but when I run it on iPad the views are messed up and rotated 90 degree anti clockwise. Do I need to do something else in order to have it run properly on iPad device.
My ipad app only runs in landscape orientation. But when I test on an actual device (not the simulator) it always seem to start in one particular landscape orientation, then turn 180 degrees to match the current physical landscape orientation. So, it seems to start in LandscapeLeft(I think) then rotate 180 if I have it in LandscapeRight. There's nothing in Info.plist to set the initial orientation.
Can anyone suggest a way to detect current orientation before view loads and set it to correct landscape view before showing?
Thanks
Fitto
There is the UIInterfaceOrientation~iPad key which sets the initial interface orientation on startup.
There is also the UISupportedInterfaceOrientations key which informs the app which orientations are supported.
There is no way, however, to make the app start in the current orientation of the iPad.
Have you looked into these questions?
Get current orientation of iPad?
iPad launch orientation
Also, technically, the iPad should just do it. Make sure you have supported orientations set properly, as I'm sure it checks those to see where it should start.