iOS--关于屏幕的方向

来源:互联网 发布:麻瓜编程python web 编辑:程序博客网 时间:2024/05/28 15:06

#pragma mark - 重写屏幕方向发生改变触发的方法

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    // 判断为横屏或者竖屏

    if (!UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {

        // 调用调整位置的方法

        [self _initAllItemsWithHorizontal];

    } else {

        [self _initAllItemsWithVertical];

    }

}




 

 

    if (self.interfaceOrientation == 1) { // 屏幕竖直

        [self _moveUpVertical:-30];

    } else if (self.interfaceOrientation == 2) { // 屏幕垂直翻转

        [self _moveUpVertical:30];

    } else if (self.interfaceOrientation == 3) { // 屏幕倒向右侧

        [self _moveUpHorizontal:110];

    } else if (self.interfaceOrientation == 4) { // 屏幕倒向左侧

        [self _moveUpHorizontal:-110];

    }

    // 关于屏幕的方向

//    typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {

//        UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,

//        UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,

//        UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,

//        UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft

//    };


0 0
原创粉丝点击