In UI code you usually should not depend on the device orientation but the user interface orientation. There's often a difference between them, for example when a view controller only supports portrait.
The most important difference for your case is that the interface orientation is never face up/down.
In your case you can just ask the view controller for the current user interface orientation: self.interfaceOrientation
.
Your condition could be expressed somewhat like if (deviceOrientation is face up/down and interfaceOrientation is landscape)
Bear in mind that a device orientation landscape left means a user interface orientation landscape right.