safeAreaLayoutGuide

iOS11新增了安全區(qū)域的概念,其中組要是增加了下邊這個類:

@property(nonatomic,readonly,strong) UILayoutGuide *safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0));

簡介:

The layout guide representing the portion of your view that is unobscured by bars and other content.

安全區(qū)域指的是視圖不被一些bar和其他內(nèi)容遮擋的部分。

When the view is visible onscreen, this guide reflects the portion of the view that is not covered by navigation bars, tab bars, toolbars, and other ancestor views. (In tvOS, the safe area reflects the area not covered the screen's bezel.) If the view is not currently installed in a view hierarchy, or is not yet visible onscreen, the layout guide edges are equal to the edges of the view.

For the view controller's root view, the layout guide accommodates the status bar, other visible bars, and any additional insets that you specified using the?additionalSafeAreaInsets?property of your view controller. For other views in the view hierarchy, the layout guide reflects only the portion of the view that is covered by other content. For example, if a view is entirely within the safe area of its superview, the layout guide edges are equal to the edges of the view.

當(dāng)視圖在屏幕上顯示的時候,guide反映了不被navigation bars,tabbar,toolbars和其他other ancestor views遮擋的部分。如果視圖還沒有添加在父視圖上,或者好沒有顯示在屏幕上,ayout guide的邊緣和視圖的邊緣平齊。

對于控制器的視圖,layout guide集合了狀態(tài)欄,其他可見bar,以及其他你應(yīng)用了additionalSafeAreaInsets屬性的控制器。

注意:safeArea最多向兼容到iOS9.0。如果兼容到8.0,那么將無法使用safeAreaLayoutGuide這個屬性。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,088評論 0 23
  • 張哥總是向萌妹賣弄他剛讀到的文章。 文章講,從遺傳上看,男孩的智商容易走極端,女生的智商更均衡。 我們身邊總是能遇...
    Sheldon_d207閱讀 332評論 0 0
  • 小滿剛立,和風(fēng)徐徐,苦菜蔥蔥。 細(xì)草化入土壤,新麥入口回甘。 至始,百草繁茂, 萬物瘋長,小得盈滿。 古訓(xùn)言:“欹...
    玉天下閱讀 286評論 0 0
  • 愛情里誰先示好誰就輸了,可偏偏這樣你還是忍不住的想去討好他。 張愛玲曾說:喜歡一個人,會卑微到塵埃里,然后開出花來...
    北渡姑娘閱讀 494評論 2 6
  • 我現(xiàn)在是一個7歲男孩子的媽媽。記得剛決定要孩子的時候我以前的同事有一天很深沉的問我,你們準(zhǔn)備好當(dāng)父母了嗎?如...
    Bella丹閱讀 275評論 0 0

友情鏈接更多精彩內(nèi)容