判断横竖屏的方法

1. 

CGRect aRect = [[UIScreenmainScreen] applicationFrame];

    if (aRect.size.height>768) {

        

        NSLog(@"height ::%f",aRect.size.height);

        NSLog(@"竖屏幕.....");

    

    }else {

        NSLog(@"height ::%f",aRect.size.height);

        NSLog(@"横屏幕.....");

    }

 

2. 有时候 没有用  这个问题我没有深究......

 

UIDeviceOrientation DO = [[UIDevicecurrentDevice]orientation];

    NSLog(@"DO::%i",DO);

    if (UIInterfaceOrientationIsPortrait(DO)) {

           NSLog(@"竖屏幕.....");

    }

    else {

         NSLog(@"横屏幕.....");

    }

 

3.

 UIDeviceOrientation DO = self.interfaceOrientation;

    if (UIInterfaceOrientationIsPortrait(DO)) {

 

        // 竖屏

  

    }else {

        NSLog(@"横屏幕.....");

        // 横屏

    

 

    }

posted @ 2012-09-06 14:27  zander  阅读(554)  评论(0编辑  收藏  举报