Pretty funny... Launch your App with the iPad lying flat on a table and ask for the deviceOrientation. The result is UIDeviceOrientationFaceUp.
What I really want to know is what is the orientation of the "desktop" or "home page".
The problem is this:
Your user has rotated the iPad into some position, watching the icons animate into position. He sees your icon and touches it. So when your App launches it is going to want to match that rotation. So you read the device orientation and go from there.
But wait... If the user rotated the iPad and then laid it down flat, he is still looking at your icon facing him. But when he launches your app and you read the device orientation, all you know is UIDeviceOrientationFaceUp. You want to rotate your App so that it is facing the user, but you don't have the correct information until he picks up the device.
Does anyone know how to read the orientation of the "desktop"?
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 527
Quote:
Originally Posted by Pitfall
Pretty funny... Launch your App with the iPad lying flat on a table and ask for the deviceOrientation. The result is UIDeviceOrientationFaceUp.
What I really want to know is what is the orientation of the "desktop" or "home page".
The problem is this:
Your user has rotated the iPad into some position, watching the icons animate into position. He sees your icon and touches it. So when your App launches it is going to want to match that rotation. So you read the device orientation and go from there.
But wait... If the user rotated the iPad and then laid it down flat, he is still looking at your icon facing him. But when he launches your app and you read the device orientation, all you know is UIDeviceOrientationFaceUp. You want to rotate your App so that it is facing the user, but you don't have the correct information until he picks up the device.
Does anyone know how to read the orientation of the "desktop"?
Thanks.
I don't have an iPad, so I'm not quiet sure how the up and down orientation works.
It seems that if you register for, and start the UIDeviceOrientationDidChangeNotification events you can get multiple Device Orientation Change Event Notifications.
In my example above, reading the device orientation at start always returns Face Up. But once the notifications begin the OS sends a Landscape Left event and follows it up immediately with a Face Up event.
So they eventually tell the App about both orientations.
Depending upon how real-time your App happens to be, if you implement the orientation change notification your device orientation might recover before you notice there is an ambiguity.
I'd still like to be able to read that orientation at start, but this will work with only a fractional time delay.