There is no way to stop someone from rotating their device. The screen is refreshes and your app probably doesn’t fit anymore. There are several ways to deal with this:
- Calculate new sizes and positions for all the controls and move them around.
- Compile using PhoneGap, setting its orientation preference to not rotate your app.
- Take advantage of the opportunity to display something else – like a status report.
- Use the new Orientation control to ask your user to rotate back.
The Orientation control displays the above warning when an app designed to be used in Portrait mode is run on a device in Landscape. When the user rotates back, the warning disappears.
To add it to your project, double click on it in the ToolBox. It only has one property that does anything: screenOrientation can be set to ‘Portrait’ or ‘Landscape’. When the device is put into a different orientation, the message displays.