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];
}
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容