iOS屏幕适配相关

//设置横屏是否开启 写在AppDelegate.m里面
- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    //[[UserInfoUtility sharedInstance]CanMaskLandscape]公共类保存这个参数作判断
    if ([[UserInfoUtility sharedInstance]CanMaskLandscape]) {
        //开启横屏左右
        return UIInterfaceOrientationMaskLandscapeRight|UIInterfaceOrientationMaskLandscapeLeft;
    }
    else
    {
        return UIInterfaceOrientationMaskPortrait;
    }
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
            //根据情况重绘界面Fram 设置屏幕宽高对调
    switch (interfaceOrientation) {
        case UIInterfaceOrientationPortrait:
            //home健在下
            break;
        case UIInterfaceOrientationLandscapeRight:
            //home健在右
            break;
            case UIInterfaceOrientationPortraitUpsideDown:
            //home健在上
            break;
            case UIInterfaceOrientationLandscapeLeft:
            //home健在左
            break;
        default:
            break;
    }
}

//针对webView设置LayoutSubviews
- (void)viewDidLayoutSubviews
{
    [webView setFrame:CGRectMake(0, 0, kScreenwidth,kScreenheight)];
    [super viewDidLayoutSubviews];
}

你可能感兴趣的:(iOS屏幕适配相关)