I have an application that I would like to save in portrait mode, with the exception of one view in which I want to detect a change in orientation, fire the js event and change the orientation (for this view only).
My application has the following code:
window.shouldRotateToOrientation = function(rotation) { switch (rotation) { case 0: case 180: console.log("Portrait"); return false;
This seems to work well when building for iOS5, keeping the application in the Portrait orientation, returning false and shooting correctly when the device is in landscape mode. However, when building for iOS6, the function is called 4 times every time the device rotates, matching each case - making detection useless.
I am approaching this correctly - is there another way or is there something that I am missing?
Please note that I have a very limited understanding of the Xcode / ios / ObjectiveC environment
reech source share