【问题标题】:show Custom Table Separator UIView in tableView在 tableView 中显示自定义表格分隔符 UIView
【发布时间】:2016-03-07 08:59:39
【问题描述】:

我有一个动态原型表视图。因为我想在单元格中显示一条线,所以我拖动一个 uiview 并放置在单元格中。问题是当我在移动设备中编译应用程序时,该行没有显示在单元格中。我在我的代码中这样做是为了填充单元格值

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("cell", 
        forIndexPath: indexPath) as! RequestTableViewCell

    cell.userNameLabel.text = firstName.uppercaseString + " " 
        + lastName.uppercaseString

    cell.contentView.addSubview(cell.tableSeparatorUIView) 
}

我觉得我在这里做错了

 cell.contentView.addSubview(cell.tableSeparatorUIView)

【问题讨论】:

  • 尝试将 UIView 设置为 cell contentView 而不是 cell.UIView --- cell.contentView.addSubview(tableSeparatorUIView)

标签: ios swift uitableview uiview


【解决方案1】:

我已经完成了示例示例。使用自动布局。 Go throght sample example 请通过链接。它会帮助你。

【讨论】:

    【解决方案2】:

    这样做:-

    在属性检查器中选择您的 TableView 做分隔符 None。然后在底部添加 UIView,高度为 1px 和前导,尾随,底部到 tableView。 .

    【讨论】:

      猜你喜欢
      • 2017-01-25
      • 2010-11-25
      • 1970-01-01
      • 2012-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-25
      • 1970-01-01
      相关资源
      最近更新 更多