2011-11-07 99 views

回答

1

我不知道考虑到文档中的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) 
相关问题