インターフェイス指向とデバイス指向の違いは何ですか? どちらも同じように見えますが、実際の違いは何ですか?
2 に答える
インターフェイスの向きは、デバイスの向きに関係なく、何でもかまいません。デバイスの向きは、保持しているデバイスの実際の物理的な向きであり、可変ではありません。それが現実さ。縦持ちなら縦です。ただし、デバイスが縦向きになっているからといって、インターフェースも縦向きになっているわけではありません。横向きのみを提供するようにアプリを要求する場合があるため、インターフェイスの向きはデバイスの向きとは異なります。
以下の説明は、このサイトから取得しました。
UIDeviceOrientation は UIDevice クラスのプロパティであり、可能な値は次のとおりです。
UIDeviceOrientationUnknown - 判別できません UIDeviceOrientationPortrait - ホーム ボタンが下向き UIDeviceOrientationPortraitUpsideDown - ホーム ボタンが上向き UIDeviceOrientationLandscapeLeft - ホーム ボタンが右向き UIDeviceOrientationLandscapeRight - ホーム ボタンが左向き UIDeviceOrientationFaceUp - デバイスは平らで、画面が上向きです UIDeviceOrientationFaceDown - デバイスは平らで、画面が向きます下
UIInterfaceOrientation に関しては、これは UIApplication のプロパティであり、ステータス バーの向きに対応する 4 つの可能性のみが含まれます。
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait、UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown、UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight、UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft (ドキュメントからコピー)
たとえば、デバイス (実際の iPhone または iPod) は UIDeviceOrientationLandscapeRight にある可能性がありますが、アプリがそれをサポートしていない場合、デバイス (アプリ) はまだ UIInterfaceOrientationPortrait にある可能性があります。
また、UIDeviceOrientation を取得するには [[UIDevice currentDevice] orientation] を使用し、UIInterfaceOrientation を取得するには [[UIApplication sharedApplication] statusBarOrientation] を使用します。
また、参照する必要があります。