Avatar ·

iOS 8 UITableView separator inset 0 不起作用:如何去除边距?

大家好!我正在用 Swift 编写一个 iOS 8 应用,遇到了一个让我抓狂的问题。我希望 UITableView 中的分隔线(separator)没有边距,即从左边缘一直延伸到右边缘。看起来很简单:我设置了 `tableView.separatorInset = UIEdgeInsetsZero` 或 `tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)`,但这不起作用——左边距仍然存在。我尝试了所有方法:在 `viewDidLoad` 中设置 inset,在 `cellForRowAtIndexPath` 中为每个 cell 设置,甚至尝试重写 cell 的 `layoutMargins`。但都没用。 这是我的代码: ```swift override func viewDidLoad() { super.viewDidLoad() tableView.separatorInset = UIEdgeInsetsZero tableView.separatorStyle = .SingleLine } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", for