Search code examples
iosobjective-cautorotateavcapture

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


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.


Solution

  • 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!