UITableView是在上面得到一个差距

Iam不知道现在是否适合问这个问题。 我在桌面视图上使用Xcode 5(预览版)。 现在的问题是,如果我的表视图被选为group比我有第一个单元格和表顶部边缘之间的差距。

下面是可用视图委托的代码

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 8; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"SimpleTableItem"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; } cell.textLabel.text = [NSString stringWithFormat:@"cell %d",indexPath.row]; return cell; } 

下图是我在xib中selectgroup的时候

在这里输入图像说明

但是,如果我切换到plain ,表是正常的

在这里输入图像说明

对这种情况有任何想法。 我GOOGLE了,但似乎没有什么在那里。 任何帮助都欢迎在这里。

这是iOS 7中分组表格视图的预期外观。如果打开“设置”应用程序,则会在表格顶部和表格视图中的每个部分之间(灰色)显示类似的分隔栏。

为了彻底,你应该实现表格视图中的部分数量,在这种情况下,返回一个。 它可能是一个Xcode 5的错误,其中如果你不实现这个方法,它会给你一个不正确的头。

如果这样做不能解决我build议实施的问题

 - (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)section 

这也可以做到这一点。