2013-07-16 54 views
15

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

为uitable视图代表该代码是下面

- (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选择group

enter image description here

然而,如果我切换到plain下面,表是正常

enter image description here

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

+1

嗯,你没有注意到设置的应用程序?我认为这是新的分组表格视图的工作原理。 – Desdenova

+3

@NilsMunch这实际上是一个很好的问题,应该在9月18日重新开放。这不是以任何方式脱离主题。 http://meta.stackexchange.com/questions/94465/should-moderators-enforce-ndas-for-software-vendors –

+1

以下是我解决了这个问题:http://stackoverflow.com/a/18938763/588253 –

回答

19

如果打开设置应用程序,你会看到类似的分隔条在表的顶部,并在表视图每个部分之间(灰色,这是一个分组的表视图的在IOS 7.预期外观)。

+3

唉: (为什么,他们为什么要打破它:(我的用户名/密码登录thingy使用分组的UITableView现在在我所有的应用程序中被破坏:( – Fogmeister

+3

嗯,分组UITableView的变化是iOS7中其他更改中最丑陋的... – CodePlumber

+0

杰克,你说的没错,谢谢你指出,我一直在试图摆脱这种差距。 –

1

对于被彻底你应该实现在表视图,在这种情况下,部分的数量起见,返回一个。它可能是一个Xcode 5的bug,其中如果你没有实现这个方法,它会为你提供一个不正确的头文件。

如果还是不是解决问题,我会建议实施

- (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)section 

这可能做的伎俩也。