ipad上自定义view的旋转适配

ios8横屏时宽高会自动转换,但是ios7不是

   CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;

    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;

    if (!iOS8)

    {

        UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];

        if (UIInterfaceOrientationIsLandscape(interfaceOrientation))

        {

            CGFloat tmp = screenWidth;

            screenWidth = screenHeight;

            screenHeight = tmp;

        }

    }

   

posted @ 2015-05-08 09:42  ZLK0011  阅读(221)  评论(0编辑  收藏  举报