0
只是想知道为什么当我尝试记录iPad的方向时我会得到整数值。是否有资源告诉我每个值的含义?我已经得到了从1到8的任何东西。我只认为有4种可能的方向,所以我很困惑。当我尝试NSLog iPad的方向时,为什么我会得到整数值?
只是想知道为什么当我尝试记录iPad的方向时我会得到整数值。是否有资源告诉我每个值的含义?我已经得到了从1到8的任何东西。我只认为有4种可能的方向,所以我很困惑。当我尝试NSLog iPad的方向时,为什么我会得到整数值?
我不知道考虑到文档中的8个不同的值显示
typedef enum {
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
您登录的方向,看看它是之前,您可以登录这一权利。
NSLog(@"UIInterfaceOrientationPortrait-%d\n\
UIInterfaceOrientationPortraitUpsideDown-%d\n\
UIInterfaceOrientationLandscapeLeft-%d\n\
UIInterfaceOrientationLandscapeRight-%d", UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight);
有方便的方法来测试特定的方向,例如
UIInterfaceOrientationIsLandscape
Returns a Boolean value indicating whether the user interface is currently presented in a landscape orientation.
#define UIInterfaceOrientationIsLandscape(orientation) \
((orientation) == UIInterfaceOrientationLandscapeLeft || \
(orientation) == UIInterfaceOrientationLandscapeRight)
你说的是UIInterfaceOrientation或其他一些设定值? –