ios – UITableView在顶部获得了空白[封闭]

栏目: IOS · 发布时间: 7年前

内容简介:这是iOS 7中分组表视图的预期外观.如果打开“设置”应用程序,您将在表格顶部和表格视图中的每个部分(颜色为灰色)之间看到类似的分隔条.代码日志版权声明:翻译自:http://stackoverflow.com/questions/17679052/uitableview-is-getting-a-gap-on-top

我不知道现在要问的是适当的问题.我在表视图上使用Xcode 5(预览版).现在的问题是如果我的表视图被选择为组,我在第一个单元格和表的顶部边缘之间有差距.

以下是适用视图委托的代码

- (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中选择组时,下面的图片

但是,如果我正在切换到普通的,表是正常的

对这种情况的任何想法.我上了谷歌,但似乎没有什么.任何帮助在这里欢迎.

这是iOS 7中分组表视图的预期外观.如果打开“设置”应用程序,您将在表格顶部和表格视图中的每个部分(颜色为灰色)之间看到类似的分隔条.

代码日志版权声明:

翻译自:http://stackoverflow.com/questions/17679052/uitableview-is-getting-a-gap-on-top


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Operating Systems

Operating Systems

Remzi Arpaci-Dusseau、Andrea Arpaci-Dusseau / Arpaci-Dusseau Books / 2012-8-19 / USD 21.00

A book about modern operating systems. Topics are broken down into three major conceptual pieces: Virtualization, Concurrency, and Persistence. Includes all major components of modern systems includin......一起来看看 《Operating Systems》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具