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];
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容