Force Rotate iOS Even When Device's Portrait Orientation Lock is ON - ios

My app needs to somehow mimic the iOS original Camera App, that even the device's AUTOROTATE is locked, the ViewController or specifically the AVCaptureVideoPreviewLayer will rotate.
So far, what I did to my project is this: Check the Landscape (right and left) in Project Properties/Settings, and then tweak each View Controllers' shouldAutorotate.
Everything is fine using this technique, until the user lock his device autorotate function (in iPAD this is a button at the side of the device, in iPhone this can be found in the settings from below the screen).
I couldn't find any answered related question on stackoverflow, so I asked.

So after few days, I have solved the problem!!! I'm still wondering though what was the reason behind in down voting my question. I have found this tutorial/blog:
Detect Device Rotation Even When Rotation Lock Is ON
So basically, the alternative way is to use CoreMotion. I hope someone who is having the same question in mind finds this answer. Cheers!

Related

Has anyone been able to override/block the new iPadOS 15 behavior of rotating iPhone apps in landscape?

The new behavior
Ideally we'd have native iPad support, but that's a ways off and not feasible at the moment. So for now we have to work with iPad running the iPhone app. Hybrid Swift and Objective-C using UIKit, for context.
The app I'm working on has a camera view controller that, prior to iPadOS 15, would not rotate the field of view between portrait and landscape. However, with this new rotation behavior, the UI is shown in portrait when the iPad is in landscape. In the case of the camera, the field of view is now flipped 90ยบ. The captured images are not flipped, but the sideways field of view isn't a good look.
What I've tried/observed so far is the following:
This new rotation behavior is not governed by the UIViewController's rotation methods. Overriding shouldAutorotate and supportedInterfaceOrientations does not prevent this rotation. So this is happening at the device level, and not the view controller level.
At the device level, I only know of one way to programmatically change orientation, using the private setter on UIDevice's orientation property. Obviously, private APIs are a no-no for the App Store, and a hack to leverage them may break in the future. Not a good solution either.
At this point I'm at the end of my rope. I have scoured Google and StackOverflow to learn more about how this new feature works, at a technical level, but details are sparse. If anyone has more information or experience with this, that would be great. Even if the answer is 'no dice'. Thanks!

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

iPhone camera landscape orientation issue

I have scenario in which the camera is to be forced to be in landscape when ever you want click . I tried various things but i am not able to make it landscape . In one forum i even read that doing so may lead to app rejection . Is it so? if not can someone give me the solution for the same ?
Which model of the iphone are you using? Do you by chance have the rotation lock enabled? Is this a third party app or the official iphone camera app? sometimes if you use a third party app, they don't always work correctly with rotation settings.
Hey i found one solution for the same through which we can give an impression to user that camera is presented in landscape mode and user will take image in landscape . We need to add a custom view (a bar giving an impression that its a landscape view) on the camera with button having click functionality hiding the default controllers of camera . See attached screenshot . Output of solution i found

Diagnose rotation problems on iPad

I am having a weird problem with keeping orientation on the iPad. Very rarely, when I swap in and out view controllers, my view is displayed as portrait, even though my device is in landscape mode.
What should I do to resolve this problem? I have already set my controllers to landscape using shouldAutorotateToInterfaceOrientation: method. Also, it appears only very rarely, making tracking the bug very difficult.
Is there a faster way to find out why the orientation is wrong, besides going through each controller?
I see your comment that you are managing orientation by code using "shouldAutorotateToInterfaceOrientation", that is specifically an iOS5 method. By any chance is the iPad iOS6? If it is, you need to back it up with "supportedInterfaceOrientations".

iPad Keyboard comes on from wrong side

I've been working on my first iPad based project which has proven a massive learning curve but I'm nearly there. I have a small issue left however.
I've got my iPad to work in all orientations as dictated by Apple however they keyboard always comes on from the Portrait position unless the user rotates the device first. Does anyone have any suggestions where this is coming from? Just can't seem to figure out the reasoning for it. Any thoughts much appreciated, I'm sure this is glaringly simple but I'm just pulling my hair out here.
The keyboard displays based on the device's true orientation regardless of the layout any views. If the device is in portrait, the keyboard displays in portrait and it will not change until the device is physically rotated to landscape.

Resources