Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Change screen orientation of UI application
The following example shows how to change the screen orientation of an S60 UI application, from portrait to landscape or vice-versa.
The method that is used to do the rotation is CAknAppUiBase::SetOrientationL(). There is also another method to get the current screen orientation, CAknAppUiBase::Orientation().
The following example shows a method that will change the orientation to portrait if the current one is landscape and vice-versa.
// Changing from portrait to landscape or vice versa.
iIsPortrait = !iIsPortrait;
// Change the screen orientation.
If the application wants just be in a single UI orientation then it should use the CAknAppUI flags to force certain orientation: EAppOrientationPortrait or EAppOrientationLandscape.
Note: The flags are names and defined differently to those used in SetOrientationL. SetOrientationL e.g. uses EAppUiOrientationPortrait whereas CAknAppUI flag for the same orientation is EAppOrientationPortrait. This is error prone and has created lot of confusion as developers do not realized the slight naming difference.
- Scalable UI
- Layout-awareness challenges in custom UIs
- How to find out the correct location for softkey labels
- How to get the Current Orientation