Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 UITableViewCell custom accessoryView goes out of bounds

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

enter image description here

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

like image 452
Martino Bonfiglioli Avatar asked Jan 28 '26 01:01

Martino Bonfiglioli


2 Answers

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

like image 111
Amerino Avatar answered Jan 29 '26 14:01

Amerino


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

like image 22
nemo Avatar answered Jan 29 '26 13:01

nemo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!