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

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.

Related

Orientation not changing to portrait, iOS game

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];

Locking a project into portrait in Xcode?

I have just begun creating a new Xcode project, and noticed that how I normally remove the function to have the app in landscape; a tick box under device orientation within the general tab of the project; has disappeared.
Has this orientation setting moved elsewhere, or must I now code it to lock it into portrait only?
Also, I am working in objective-c.
Thanks.
Click on your project on the left menu, next uncheck Landscape mode in Device Orientation:

iPad storyboard changes not happening?

I started a xcode project for iPhone and now I'm working it also for iPad (Universal App).
So in devices I put Universal and I create the iPad storyboard and make the necessary changes (in plist file and build settings) and now anything I edit in the ipad storyboard is done, obviously yes on code but not in the storyboard (I'm working without auto-layout so Its disabled in both storyboards).
What can I do? I've checked everything and it's in order.
Just a guess, but you might be getting an error showing up in your debug console. Make sure that the storyboard has an entry point. Select the viewContoller that is the entry point and check the checkbox for "is initial view controller" in the utilities pane.
did you check the target> General> their did you give the storyboard for ipad? if you look, you can see the selection on iphone and your iphone storyboards name below it. Change it to ipad and enter the storyboard?

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.

Rotating a view in objective-c

I am trying to make the multitasking switcher open in landscape mode all the time... even when the phone is being held in portrait... Any ideas? The class is "SBAppSwitcherController" and I'm calling the method "viewDidAppear"
Just set the Supported Interface Orientations to only landscape modes. To do that, you go to your project in the Project Navigator. Then, you will see the Supported Interface Orientations header. Click the dark icons referring to portrait mode to make them light. Then your program will only be in landscape mode. So, if I know what you are saying, you are done!

Resources