Using accelerometer to detect iPad lock switch trigger?
        Posted  
        
            by DevDevDev
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by DevDevDev
        
        
        
        Published on 2010-04-20T21:31:23Z
        Indexed on 
            2010/04/20
            21:33 UTC
        
        
        Read the original article
        Hit count: 404
        
So for complicated reasons I am managing view rotations myself, and am only implementing UIDeviceOrientationPortrait as the autorotating orientation.
Anyway, when one clicks the screen lock on the iPad, the device will rotate to UIDeviceOrientationPortrait, which will cause my code to rotate, which I do not want to happen. For instance of the user is holding the device in "landscape mode", i.e. I have already manually rotated the UI to landscape mode, and he/she clicks the screen lock, it will rotate the UI to portrait mode, even though the user did not move the device at all.
So somehow I need a way to differentiate between rotations to portrait mode occuring from the screen lock, and those occuring from device rotation. As such, I would like somehow to use the accelerometer to detect whether or not the device was actually 'rotated' or whether the button was clicked.
Thanks!
© Stack Overflow or respective owner