TableView的屬性

在ios開發(fā)中,tableView幾乎是我們最常用到的幾種控件之一了,但是對于初學者來說。常常會對contentSize、contentOffset、contentInset三個概念模糊不清,以下是自己這三個屬性的自我理解(僅針對垂直方向):
一、基本概念的認識:
1.什么是tableView的內容(content):
包括三個方面分別是:cell、tableFooterView/tableHeaderView、sectionHeader/sectionFooter
2.contentSize.height:內容的高度
3.什么是內容的偏移量(offset):
內容的偏移量 = frame的頂部 - content的頂部
4.contentInset:內容周圍的間距(內邊距)
5.Frame
Frame.height:矩形框的高度
frame:以父控件內容的左上角為原點
二、認識進階:
1.沒有cell、沒有contentInset、沒有tableHeaderView和tableFooterView


Snip20160411_2.png

2.沒有cell、沒有contentInset、有tableHeaderView和tableFooterView


Snip20160411_4.png

3.有cell、沒有contentInset、沒有tableHeaderView和tableFooterView
Snip20160411_5.png

4.有cell、有contentInset、沒有tableHeaderView和tableFooterView
Snip20160411_6.png

5.有cell、沒有contentInset、有tableHeaderView和tableFooterView
Snip20160411_7.png

6.有cell、有contentInset、有tableHeaderView和tableFooterView
Snip20160411_8.png

7.沒有cell、沒有contentInset、有tableHeaderView和tableFooterView、有額外子控件{0、-40、375、40}
Snip20160411_10.png

8.沒有cell、沒有contentInset、沒有tableHeaderView和tableFooterView、有額外子控件{0、-40、375、40}
Snip20160411_11.png

9.有cell、沒有contentInset、有tableHeaderView和tableFooterView、有額外子控件{0、-40、375、40}
Snip20160411_12.png

10.有cell、有contentInset、有tableHeaderView和tableFooterView、有額外子控件{0、-40、375、40}


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

相關閱讀更多精彩內容

友情鏈接更多精彩內容