【问题标题】:UITableViewCell separator insets don't workUITableViewCell 分隔符插入不起作用
【发布时间】:2023-04-09 16:13:02
【问题描述】:

我在故事板中将分隔符插入设置为 0,但是当我运行代码时,插入不是 0 。难道是iOS的bug?这里有什么解决方法吗? (我是 iOS 开发新手)

【问题讨论】:

  • 请张贴截图,你是在 iOS 设备上签到吗?

标签: ios swift uitableview


【解决方案1】:

UITableViewDelegatewillDisplayCell函数添加到您的代码中并设置您的单元格的separatorInsetlayoutMargins

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
      cell.separatorInset = UIEdgeInsetsZero
      cell.layoutMargins = UIEdgeInsetsZero
}

【讨论】:

  • 非常感谢
猜你喜欢
  • 2017-08-04
  • 1970-01-01
  • 2014-11-04
  • 1970-01-01
  • 2014-01-18
  • 2015-10-10
  • 1970-01-01
  • 2015-12-22
相关资源
最近更新 更多