iOS 13 UITableViewCell custom accessoryView goes out of bounds

别等时光非礼了梦想. 提交于 2019-12-07 15:38:05

问题


Working with the latest iOS 13 beta

I really don't understand if it's beta issues or my issue, but I don't have this problem with iOS 12

code

 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"

with result

Did someone had the same issue and found a solution? Thanks


回答1:


If you put the uibutton in a uiview it will work on iOS 13.0.




回答2:


I am using UILabel instead of UIButton, and same issue occurred with iOS13.1. @Amerino's workaround does well.




回答3:


This problem is solved in the latest beta of iOS 13.1 (beta 2)



来源:https://stackoverflow.com/questions/57791055/ios-13-uitableviewcell-custom-accessoryview-goes-out-of-bounds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!