• <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的一些事


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

        本類教程下載

        系統下載排行

        主站蜘蛛池模板: 妻子5免费完整高清电视| 三年片在线观看免费大全电影| 97热久久免费频精品99| 久久精品国产亚洲AV无码麻豆 | 亚洲一欧洲中文字幕在线| 你懂的免费在线观看网站| 亚洲AV无码精品色午夜在线观看| baoyu777永久免费视频| 亚洲AV无码乱码在线观看裸奔| 99久久国产精品免费一区二区| 久久久亚洲精品国产| 69视频免费观看l| 国产精品亚洲自在线播放页码| 久久久久国产精品免费免费搜索 | 十八禁无码免费网站| 亚洲成人黄色在线观看| 成年人在线免费看视频| 羞羞视频免费网站入口| 自拍偷自拍亚洲精品第1页| 午夜影院免费观看| 亚洲一区无码中文字幕乱码| 日韩毛片免费在线观看| 亚洲阿v天堂在线2017免费| 亚洲电影国产一区| 欧洲黑大粗无码免费| 黄人成a动漫片免费网站| 精品国产亚洲一区二区三区| 久久精品人成免费| 亚洲欧美成人av在线观看| 亚洲午夜AV无码专区在线播放| 国内精品免费视频精选在线观看| 亚洲国产成人va在线观看网址| 国产裸模视频免费区无码| 免费a级毛片无码a∨免费软件| 亚洲性猛交xx乱| 亚洲人成无码网站久久99热国产| 一区二区三区观看免费中文视频在线播放| 亚洲人成影院77777| 国产亚洲精品线观看动态图| 性xxxxx免费视频播放| 成人免费网站视频www|