• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 蘋果教程教程 > 詳細頁面

        iOS 適配iPhone X的辦法_IOS

        iOS 適配iPhone X的辦法_IOS

        更新時間:2024-04-09 文章作者:未知 信息來源:網絡 閱讀次數:

        因為iPhone X奇特的劉海存在,iOS11之后系統深化了“安全區域”概念,安全區域就是從屏幕上切除最大的矩形之外的區域。iOS11后UIScrollView新增contentInsetAdjus...

        因為iPhone X奇特的劉海存在,iOS11之后系統深化了“安全區域”概念,安全區域就是從屏幕上切除最大的矩形之外的區域。

        iOS11后UIScrollView新增contentInsetAdjustmentBehavior屬性,默認配置UIScrollViewContentInsetAdjustmentAutomatic,效果上就是沒使用安全區域。若針對具體頁面需要使用安全區域,可以查看API中新增加的那些屬性。

        /** 
         * 適配iPhone X的安全區域 
         * isUse = 1 表示使用安全區域 
         * isUse = 0 表示不使用安全區域 
         */ 
        + (void)adaptationSafeAreaWith:(UIScrollView *)sv useArea:(NSInteger)isUse { 
          if ([[sv class] isSubclassOfClass:[UIWebView class]]) { 
            UIWebView *webView = (UIWebView *)sv; 
            for (UIView *aView in [webView subviews]) { 
              if ([aView isKindOfClass:[UIScrollView class]]) { 
                sv = (UIScrollView *)aView; 
                break; 
              } 
            } 
          } 
        #ifdef __IPHONE_11_0 
          if ([sv respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { 
            if (isUse) { 
              if (@available(iOS 11.0, *)) { 
                sv.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 
                if ([[sv class] isSubclassOfClass:[UITableView class]]) { 
                  UITableView *tv = (UITableView *)sv; 
                  [tv setInsetsContentViewsToSafeArea:NO]; 
                } 
              } else { 
                // Fallback on earlier versions 
              } 
            } else { 
              if (@available(iOS 11.0, *)) { 
                sv.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways; 
              } else { 
                // Fallback on earlier versions 
              } 
            } 
          } 
        #endif 
        } 
        typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) { 
          UIScrollViewContentInsetAdjustmentAutomatic,   // Similar to .scrollableAxes, but for backward compatibility will also adjust the top & bottom contentInset when the scroll view is owned by a view controller with automaticallyAdjustsScrollViewInsets = YES inside a navigation controller, regardless of whether the scroll view is scrollable 
          UIScrollViewContentInsetAdjustmentScrollableAxes, // Edges for scrollable axes are adjusted (i.e., contentSize.width/height > frame.size.width/height or alwaysBounceHorizontal/Vertical = YES) 
          UIScrollViewContentInsetAdjustmentNever,     // contentInset is not adjusted 
          UIScrollViewContentInsetAdjustmentAlways,     // contentInset is always adjusted by the scroll view's safeAreaInsets 
        } API_AVAILABLE(ios(11.0),tvos(11.0)); 

        以上這篇iOS 適配iPhone X的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持本站。

        您可能感興趣的文章:
        • 淺談iphone X的簡單適配問題(推薦)
        • iPhone X官方文檔的適配學習詳解
        • iOS11和iPhoneX適配的一些坑
        • 關于適配iOS11和iPhoneX的一些事


        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統下載排行

        主站蜘蛛池模板: 宅男666在线永久免费观看| 免费一区二区三区四区五区| 亚洲午夜免费视频| 成人au免费视频影院| 久久久青草青青国产亚洲免观 | 亚洲七久久之综合七久久| 中文字幕免费在线看| 在线免费观看a级片| 亚洲色偷偷综合亚洲AV伊人蜜桃| 东方aⅴ免费观看久久av| 国产资源免费观看| 亚洲国产精品综合久久网各| 色www永久免费网站| 国产麻豆剧传媒精品国产免费| 蜜芽亚洲av无码一区二区三区 | 免费黄色大片网站| 久久亚洲精品国产精品| 国产乱妇高清无乱码免费| 蜜臀91精品国产免费观看| 色天使亚洲综合一区二区| A级毛片内射免费视频| 亚洲精品在线电影| 亚洲精品免费观看| 久久狠狠爱亚洲综合影院| 九九美女网站免费| 久久久亚洲精品蜜桃臀| 久操免费在线观看| 亚洲国产成人高清在线观看| 一级毛片免费播放视频| 国产午夜影视大全免费观看| 一区二区亚洲精品精华液| 国产免费131美女视频| a级毛片高清免费视频就| 亚洲综合久久久久久中文字幕| 成人黄动漫画免费网站视频| 亚洲导航深夜福利| 国产一区二区三区在线免费| 免费的全黄一级录像带| 亚洲日韩精品国产3区| 浮力影院亚洲国产第一页| 午夜免费1000部|