设置section的标题,api提供了相应的方法,如果没有特别的要求,默认是显示一个字符串标题
-(NSString ) tableView:(UITableView ) tableView titileForHeaderInSection:(NSInteger) section
此方法可以直接返回section的标题
如何自定义section标题
一般情况下我们是需要自定义section的标题的
-(UIView ) tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section
我们可以在这里直接返回section标题对应的UIView
要注意的是,返回的View的左margin是为0 的,所以我们应该再设置一个View1,添加到View上,并设置位置。
返回section的title的高度
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
可以直接返回高度值。