iOS 13 UITableViewCell 自定义 accessoryView 越界

iOS 13 UITableViewCell custom accessoryView goes out of bounds

使用最新的 iOS 13 beta

我真的不明白这是测试版的问题还是我的问题, 但是 iOS 12

没有这个问题

代码

 let button = UIButton(type: .custom)
 button.setTitle("connect", for: .normal)
 button.backgroundColor = UIColor(rgb: 0xFF0E83)
 button.sizeToFit()
 cell.accessoryView = button
 cell.textLabel?.text = "Title"
 cell.detailTextLabel?.text = "Subtitle"

结果

有人遇到同样的问题并找到解决方案了吗?谢谢

此问题已在 iOS 13.1 (beta 2)

的最新测试版中解决

如果将 uibutton 放在 uiview 中,它将在 iOS 13.0.

上运行

我正在使用 UILabel 而不是 UIButton,iOS13.1 也出现了同样的问题。 @Amerino 的解决方法很好。