2012-11-12 2 views
1

내 UITableView는 아이 패드가 아닌 보이지 않는 헤더/인셋을 가지고 있습니다.ipad tableview에서 보이지 않는 헤더를 제거

iphone tableView ipad tableView 내가 시도하는 모든 성공하지,이 원하지 않는 헤더/삽입을 제거하려면 다음을 수행하십시오 ...

- (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]; 
} 

답변

1

가 좋아, 나는 마침내 방법을 발견

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

nil, CGRectNull, CGRectZero 또는 다음을 사용할 수 없습니다. 높이는 0.f입니다. 그래서 에 최대한 가깝도록 FLT_MIN을 사용했습니다.

+0

이상한 이유로 'CGRectZero'가 작동하지 않지만! 좋은 발견. – Endareth