【发布时间】:2023-04-09 16:13:02
【问题描述】:
我在故事板中将分隔符插入设置为 0,但是当我运行代码时,插入不是 0 。难道是iOS的bug?这里有什么解决方法吗? (我是 iOS 开发新手)
【问题讨论】:
-
请张贴截图,你是在 iOS 设备上签到吗?
标签: ios swift uitableview
我在故事板中将分隔符插入设置为 0,但是当我运行代码时,插入不是 0 。难道是iOS的bug?这里有什么解决方法吗? (我是 iOS 开发新手)
【问题讨论】:
标签: ios swift uitableview
将UITableViewDelegate的willDisplayCell函数添加到您的代码中并设置您的单元格的separatorInset和layoutMargins:
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero
}
【讨论】: