How to get device orientation on iOS Simulator 4.2

[[UIDevice currentDevice] orientation] won’t work on simulator,

instead use

[UIApplication sharedApplication] statusBarOrientation];

Blogged with the Flock Browser