Ner*_*ero 20
您可能在代码或Interface Builder中将分隔符insets设置为0(可以在Attributes检查器中找到:

这也导致标题没有插入.左侧的默认值为15,右侧的默认值为0.
小智 5
[你能发布你的代码UITableViewDelegate吗?在UITableView,没有API可以在节标题中设置此插入,因此您可以返回自定义UIView,tableView:viewForHeaderInSection:然后设置所需的布局.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [UIView alloc] init];
UILabel *headerLabel = [UILabel alloc] init];
headerLabel.text = @"xxx";
[headerLabel sizeToFit];
headerLabel.frame = CGRectMake(20, 0, CGRectGetWidth(headerLabel.frame), CGRectGetHeight(headerLabel.frame));
[headerView addSubview:headerLabel];
headerView.frame = CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), CGRectGetHeight(headerLabel.frame));
return headerView;
}
| 归档时间: |
|
| 查看次数: |
9689 次 |
| 最近记录: |