Orientation not changing to portrait, iOS game - ios

Am new to Xcode, using version 8, and have a small game done.
The problem I am facing is that the orientation is in landscape, which I can't get to portrait, in the simulator and on device.
Tried the following :
Changing Device Orientation under Deployment Info to Portrait,
Adding 'Portrait' under Supported interface orientations in the Info.plist file.
Maybe I m missing out on something that I may have overlooked. Could somebody shed some light on this?

Check under General/Deployment Info, There are checkbox options for Portrait, Upside down, Landscape left, landscape right. Make sure your intended options are also ticked appropriately. Also, check your "vary for traits" in your storyboard. There may be some conflict or something. If your game was made in Unity/Unreal, you gotta check the settings there before exporting to iOS format.

Well, just found this out. I am using cocos2D framework, which has the 'startUpOptions' Dictionary object (in AppDelegate.m) that need to be specified if the game needs to be in 'Portrait' mode thus:
[startUpOptions setObject:CCScreenOrientationPortrait forKey:CCSetupScreenOrientation];

Related

I have the device orientation of my app (iOS/ Swift) set to portrait only, however the screen still rotates?

Picture of deployment settings
As you can see in the picture, I have set my device orientation to portrait only, but the app will still rotate. I am coding completely programmatically, so there is no storyboard. Any Ideas?
After some headache I found that the reason it was acting up was because, I had not selected A Main interface in the "general" Target menu. This mistake started because I had deleted my storyboard to code UI programmatically. If you do the same select "LaunchScreen.storyboard", and your app will work normal.

When rotating device the content isnt turning

Hello maybe someone can help me, I've got an issue with landscape. I've done the auto layout, but when I actually rotate the device the content isn't turning at all. Anyone knows what to do?
Click your project, and go to your iOS target. In the general tab, make sure device orientation is checked for the landscape orientations:
This change should also be reflected in the info.plist file.

Landscape only on XCode 6

Hi so I've been playing around with XCode and can't seem to figure out how to make an application landscape only. Wondering if there is a simple/storyboard solution.
I've tried checking the landscape left and landscape right and unchecking the portrait on the general page under "device orientation".
However this strangely just displays the w Compact h Regular set up on my storyboard horizontally (as opposed to showing the W Any h Compact set up). I mean technically I can work around this, but it seems annoying/inefficient to rotate my head 90 degrees while working on the portrait settings.
If there is only solution in code, I would appreciate it in swift!
EDIT: Hmmm, after some testing it seems as if the phone I'm testing on only shows the rotated version of the portrait settings. It's an iPhone 4 and maybe outdated for handling 2 seperate set ups for portrait and landscape.
Thanks!
Just for anyone with this problem in the future, here's the problem:
The storyboard editor by default will display the editor as any by any, as it should. Size classes should ONLY be used when you need to change something specifically for one kind of size class (in other words, things that will be different on different devices. You should still edit everything in the any x any orientation, and regardless of if it's landscape only because size classes will still change from device to device for landscape orientation.
It's an iPhone 4 and maybe outdated for handling 2 seperate set ups for portrait and landscape
That could be it. Size Classes were invented in iOS 8. So on a system earlier than iOS 8, they are not supported, and your results will be, shall we say, unpredictable.

Screen Rotation in iOS

I need some help regarding "Screen Rotation". I am creating this application in Landscape mode but I also want to be able to turn the iPad to Portrait mode. I am trying something different and making the application inside the viewcontroller. Basically copy and paste a view controller over and over. My issue is that even after I select, "Portrait" to be the ViewControllers Mode it still changed to landscape when i the iPad is turned to Landscape mode. I hope this made sense. Any answers are greatly appreciated!
If you're setting the supported orientation modes under the 'Deployment Info' section of your project file in Xcode, might be worth double checking that you are setting the modes for iPad rather than iPhone if you setup your project as a Universal app.

iOS Simulator Loading Upside-Down in XCode

I haven't done anything funky with my code, and am running the latest version of XCode, but for some reason when I run a build on the simulator, everything works perfectly except for the fact that it's upside down. Any idea why that could be the case?
Thanks in advance.
I had (have) this problem also. At first I though I found it when I created a fresh app and compared the Info.plist and discovered my app had the Supported Device Orientations different from the fresh app.
Specifically, I had Portrait Top above Portrait Bottom. After I put the Portrait Bottom at the head of the list the problem disappeared.
Or so I thought. I reorganized the main folder and put all the PNG files into a Resources folder. Deleted the old references in the project and add in the new locations and now the problem is back.
Also, noted the problem is occuring on the actual iOS device. You can see in this launch pix the status bar and picture are both upside down. As soon as my mainView loads the view orients correctly and becomes upright in the Portrait Top orientation.
[Picture of the launch1
There has to be something about the project file that is causing this. Still searching.
Looking around I found [this2 which states the order is important and the top most is the inital view. So now I am really puzzled as the Portrait Bottom is at the head of the list.
This happened to me too today. Easiest temporary fix is to look at your target's "Supported Device Orientations" on the "Summary" tab. My guess is that both "Portrait" and "Upside Down" are selected.
For some reason my XCode was defaulting to "Upside Down" and deselecting that orientation made the problem go away.
Found the solution!
Evidently there is a bug in Interface Builder. If you simply click off all the orientations, then click them back on in the desired order the Info.plist is built correctly.

Resources