横竖屏切换

 

viewWillLayoutSubviews  这个函数是切换横竖屏的接口

这个方法在viewcontroller里面响应,view是不响应的
- (void)viewWillLayoutSubviews

{
    
    [self _shouldRotateToOrientation:(UIDeviceOrientation)[UIApplication sharedApplication].statusBarOrientation];
    
}

-(void)_shouldRotateToOrientation:(UIDeviceOrientation)orientation {
    if (orientation == UIDeviceOrientationPortrait ||orientation ==
        UIDeviceOrientationPortraitUpsideDown) {
        // 竖屏
        
        
    }else {
        // 横屏
        
        
        
    }
}

posted @ 2016-02-18 16:16  *宁宁  阅读(179)  评论(0编辑  收藏  举报