从ipad tableview中删除不可见的标题

从ipad tableview中删除不可见的标题,ipad,header,tableview,Ipad,Header,Tableview,我的UITableView在iPad上有某种看不见的标题/插图,而在iPhone上没有 我尝试了以下所有操作以删除此不需要的标题/插图,但未成功: - (void)viewDidLoad { [super viewDidLoad]; self.tableview.sectionHeaderHeight = 0.f; self.tableview.sectionFooterHeight = 0.f; self.tableview.tableHeaderView

我的UITableView在iPad上有某种看不见的标题/插图,而在iPhone上没有

我尝试了以下所有操作以删除此不需要的标题/插图,但未成功:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.tableview.sectionHeaderHeight = 0.f;
    self.tableview.sectionFooterHeight = 0.f;
    self.tableview.tableHeaderView = nil;
    self.tableview.tableFooterView = nil;
    self.tableview.contentInset = UIEdgeInsetsZero;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.f;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @"";
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [[[UIView alloc] initWithFrame:CGRectNull] autorelease];
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [[[UIView alloc] initWithFrame:CGRectNull] autorelease];
}

好吧,我终于找到了一个方法

self.tableview.tableHeaderView = [[[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, 0.f, FLT_MIN)] autorelease];

您不能使用:
nil
CGRectNull
CGRectZero
,或高度为
0.f
的任何内容。所以我用
FLT\u MIN
尽可能接近
0.f

好的,我终于找到了一种方法

self.tableview.tableHeaderView = [[[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, 0.f, FLT_MIN)] autorelease];

您不能使用:
nil
CGRectNull
CGRectZero
,或高度为
0.f
的任何内容。所以我使用了
FLT\u MIN
来尽可能接近
0.f

出于某种奇怪的原因,
CGRectZero
不起作用,但这确实起作用!很好的发现。出于某种奇怪的原因,
CGRectZero
不起作用,但这确实起作用了!很好的发现。