多くのサイトでデバイスの向きを取得する方法は以下であると書いてある。
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
が、これを使うとデバイスの向きの判定が間違うことがあった。具体的には横向きの状態でUIDeviceOrientationIsPortrait(orientation)がYESになることがあった。
orientationの取得方法を以下のように変更すると直った。
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
原因がわからないままなので気持ち悪いが。。直ったのでよし。