0

Can somebody explain how Apple is handling autorotation in the default camera app?

  1. Apple doesn't enable rotation in actual sense, but understands that the device has rotated.
  2. It then changes the orientation of the UIControls on the screen and accommodates them to the new orientation, but the actual view doesn't autorotate.

I trying to fiddle with the iOS camera for a new app and have scratched my head whole day trying to understand if they are playing around with a view hierarchy or if they are handling custom notifications but I cannot understand.

I don't want auto-rotation; I simply want to know if user rotated his/her device - pretty much how Apple implements in their native camera app (with or without rotation disabled).

EDIT: Is there no other way to do it without Accelerometer?

p0lAris
  • 4,750
  • 8
  • 45
  • 80
  • `UIDeviceOrientationDidChangeNotification`, https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html – holex Jul 30 '14 at 15:09
  • Have a look at this: http://stackoverflow.com/a/12086463/1019630 – Neeku Jul 30 '14 at 15:15
  • possible duplicate of [Detecting iOS orientation change instantly](http://stackoverflow.com/questions/12085990/detecting-ios-orientation-change-instantly) – Neeku Jul 30 '14 at 15:15
  • "(with or without rotation disabled)"; `UIDeviceOrientationDidChangeNotification` does not work with rotation lock enabled. Please read. – p0lAris Jul 30 '14 at 15:16
  • 1
    When is orientation locked, iOS will report the last supported locked orientation. However, I believe it's possible to watch UIAccelerometer which reports regardless of orientation lock. – Dandy Jul 30 '14 at 15:43
  • Thanks. Looks like that's the only way. – p0lAris Oct 02 '14 at 00:49

1 Answers1

0

As suggested by comments and by browsing throw the interwebs, handling this through the accelerometer is the only possible solution.

p0lAris
  • 4,750
  • 8
  • 45
  • 80