I have a custom UIView containing UILabel as cell.accessoryView = containerView. It was working fine until iOS 14 but as of iOS 15, the containerView is changing its frame on tableView reload. It is displaying properly on the first load but reloading causes the accessoryView to change its frame. My code is
let notificationLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
let containerView = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
containerView.clipsToBounds = true
containerView.backgroundColor = .clear
containerView.addSubview(notificationLabel!)
cell.accessoryView = containerView
I am changing the frame of the container based on text in UILabel in cellForRowAtIndexPath.
It seems the frame code for containerView is messing up. But this is working fine in iOS 14.
I guess there are some changes and the accessoryView position is allowed to be changed in iOS 15.
Any suggestions to make it work without giving exact x-axis or y-axis in iOS 15?
It's possible what your seeing is the extra "by default" padding added to the section header.
In your Viewdidload add