本篇向大家介绍UITalbeView的内容,内边距,偏移量是什么,以及各种呈现的情况.
一、作为TableView的内容(content)由如下部分组成:
1.cell
2.tableHeaderView\tableFooterView
3.sectionHeader\sectionFooter
二、作为TableView的内容包含着如下属性:
contentSize.height: 所有内容的总高度
contentInset: 在内容周围额外增加的间距(内边距),始终粘着内容
contentOffset: 内容距离frame矩形框,偏移了多少
frame: 是以父控件内容的左上角为坐标原点{0,0}
bounds: 是以自己内容的左上角为坐标原点{0,0}
三、UITableView的各种展现形式的情况说明:
1. tableView在没有Cell,没有ContentInset, 没有header和footer的情况下:
2. tableView在没有cell没有contentInset, 而有header和footer的情况下, (注意此时的内容为tableHeaderView + tableFooterView) :
3.
tableView在有cell, 没有contentInset, 没有header和footer的情况下 (此时内容为整个cell):
4. tableView在有cell, 没有contentInset, 有header和footer的情况下 (此时内容为header + cell + footer) :
5. tableView在有cell, 有contentInset, 有header和footer的情况下 (此时的内容为 header + cell + footer):
6. tableView在有cell, 没有contentInset, 没有header和footer, 但是有额外子控件的情况下 (此时的内容依然为整个cell):
7. tableView在有cell, 有contentInset, 没有header 和footer的情况下 (内容依然为整个cell):
希望大家对tableView的这些重要属性掌握属性, 千万不要混淆之间的关系,谢谢!