UIInterfaceOrientation
は、enum
本質的に整数であることを意味します。ブール値には整数を割り当てることができます。ブール値は単純に true または false に相当します。0
ブール値がまたはに等しく設定されている場合nil
、それは false です。or (またはその他のd に相当するもの) 以外に設定されている場合は true になります。UIInterfaceOrientation は列挙型 (整数) であるため、0 に等しい場合、ブール値は false になります。0 以外の場合は true になります。0
nil
#define
の値UIInterfaceOrientation
:
typedef enum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
} UIDeviceOrientation;
このリストの最初のものは と等しくなり0
ます。next 1
、 next2
など。UIDeviceOrientationUnknown
ブール値を false に設定します。それ以外は true に設定されます。
いずれにしても、この関数を正しく使用していません。この関数内のコードは次のようにする必要があります。
if((interfaceOrientation == someOrientationYouWantToWork) || (interfaceOrientation == someOtherOrientationYouWantToWork)
{
return YES;
}
else
{
return NO;
}
someOrientationYouWantToWork
上に投稿した列挙型の値に etc を設定します。どのオリエンテーションで働きたい場合でも、戻っYES
てください。それ以外の場合は を返しNO
ます。