【问题标题】:gray line on top of UITableView iOS 5UITableView iOS 5顶部的灰线
【发布时间】:2012-04-24 13:54:02
【问题描述】:

在 iOS 5 中,我的 UITableView 顶部出现了一条奇怪的灰线(在我升级到 Xcode 4.3 并在 iOS 5 iPhone 上运行应用程序之前从未出现过) - 有其他人看到过吗?我的其他一些 TableViewController 中也出现了有趣的白线,我通过这样做摆脱了这些白线:

    // needed to get rid of funny white lines in iOS 5
    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
tableView.separatorColor = [UIColor clearColor]; 

但是,删除此行不起作用。这里没有标题。该行使用我的 UITableView 上下滚动

【问题讨论】:

  • 试试这个:tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  • 感谢您的快速响应 - 不幸的是,这不起作用,线路仍然存在

标签: uitableview ios5 three20


【解决方案1】:

我有同样的问题,但它只出现在编辑模式。 我需要标题,所以以前的答案不适合我。 但是这个答案对我有帮助Remove top gray line on UITableViewCell ,希望对遇到同样问题的人有所帮助。

tableView.separatorColor = [UIColor clearColor]; 

【讨论】:

    【解决方案2】:

    您可能正在实现 heightForHeaderInSection 方法。 要么完全删除它,要么返回 0。

    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
        return 0.0;
    }
    

    【讨论】:

      【解决方案3】:

      如果您有一个简单的背景,将colorWithPatternImage 更改为colorWithRed:green:blue:alpha 就可以了。

      //self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]];
      self.tableView.backgroundColor = [UIColor colorWithRed: green: blue: alpha:]
      

      但是对于这样的背景,如果您可以裁剪 background.png 图像以使倾斜的图像构成整个背景,则会删除顶部的线条。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-11-02
        • 1970-01-01
        • 2023-02-04
        • 1970-01-01
        • 1970-01-01
        • 2021-11-16
        • 2014-07-23
        相关资源
        最近更新 更多