TableView的属性

2016-04-11  本文已影响90人  木子尚武

在ios开发中,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
上一篇下一篇

猜你喜欢

热点阅读