Ios UITableView节标题放置错误
我的UITableView中出现了一个非常奇怪的错误。我使用的是标准视图和剖面Ios UITableView节标题放置错误,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我的UITableView中出现了一个非常奇怪的错误。我使用的是标准视图和剖面 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 44.0f; } - (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 44.0f;
}
- (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch (section)
{
case kSectionProfile:
return @"Profile";
break;
case kSectionContacts:
return @"Contacts";
break;
case kSectionApps:
return @"Apps";
break;
case kSectionSettings:
return @"Settings";
break;
case kSectionCount:
return nil;
break;
}
return nil;
}
TableView来自XIB
模拟器:
这是UITableView的顶部,节永远不会接触可见区域的顶部,单元格是围绕节标题绘制的。
我不知道是什么导致了这些奇怪的问题。UITableView顶部的计算似乎不正确。更新:
取消勾选层次结构中VC对象的序列图像板/XIB中的以下框
从这里开始:
旧答案:
使用-cgloattableview:UITableView*tableView heightForHeaderInSection:NSIntegersection委托方法并查看是否有帮助
例如
已经尝试过了,但并没有解决任何问题,只是让标题变得更大,但它们仍然并没有触及桌面
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20.0f;
}