在ios7中使用group类型的tableview时,默认的情况下个section直接的距离是相同的,因此第一个section距离navigationbar的距离也不符合需求,此时若在viewdidload方法中通过设置tableview.sectionHeaderHeight的属性值是无效的。需要通过方法
设置headerView
的高度,具体操作如下:需要注意的是,如果把值设为0.0,即相当于未进行设置。
– (
CGFloat
)tableView:(
UITableView
*)tableView heightForHeaderInSection:(
NSInteger
)section
{
return
1
.0
;
}
若还想设置其他sections之间的距离,则
不能
使用
– (CGF
loat
)tableView:(
UITableView
*)tableView heightForFooterInSection:(
NSInteger
)section这个方法。
需要使用t
ableView
.
sectionFooterHeight
= 3
.0。对sectionFooterHeight这个属性进行设置,
这个距离的计算是header的高度加上footer的高度。