1

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.

Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95
  • try a transformation view.transform = CGAffineTransformMakeRotation(M_PI); – Anshad Rasheed Nov 23 '15 at 10:41
  • yes, I can do that, thanks. But my question, again, was: how to force the rotation WHEN the device rotation function is LOCKED. Detecting when the device rotates is easy: http://stackoverflow.com/questions/30202597/preventing-avcapturevideopreviewlayer-from-rotating-but-allow-ui-layer-to-rotat – Glenn Posadas Nov 23 '15 at 12:14
  • 1
    please check this http://stackoverflow.com/questions/13833908/force-camera-view-in-landscape-with-orientation-lock-on – Anshad Rasheed Nov 23 '15 at 12:36
  • I already did, in fact I've implemented the solution on that link, thank you AnshaD, still, my question is not yet answered, and for some reason, someone downvoted my question without any explanation. – Glenn Posadas Nov 24 '15 at 01:20

1 Answers1

0

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!

Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95