An extra UITableViewCellContentView overlay appears in a TableView on iOS 14 preventing taps, but works fine on iOS 13 An extra UITableViewCellContentView overlay appears in a TableView on iOS 14 preventing taps, but works fine on iOS 13 swift swift

An extra UITableViewCellContentView overlay appears in a TableView on iOS 14 preventing taps, but works fine on iOS 13


You have to add your views to cell contentView like this:

contentView.addSubview(button)

and anchor your button to contentView:

button.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true


If your project is big and it's hard to change every addSubview to contentView.addSubview, you can add this extension to your project:

extension UITableViewCell {    open override func addSubview(_ view: UIView) {        super.addSubview(view)        sendSubviewToBack(contentView)    }}


I had this same issue, although I'm not sure my solution will work for you or not. My issue was caused by the UISearchControllerDelegate method presentSearchController being called twice in iOS14. When this method was called, we superimposed a new "containerView" onto our current View and displayed our search results. when didDismissSearchController is called we removed this view. The problem is that presentSearchController was being called twice, which created two "containerViews". we would remove one of them but the other one stuck around and intercepted all of our touches. We just needed to make sure not to add two "containerViews".

Here is what we did

func presentSearchController(_ searchController: UISearchController) {    guard containerView == nil else {return}   containerView = UIView()   viewController.view.addSubview(containerView)   //present search results}func didDismissSearchController(_ searchController: UISearchController) {    containerView.removeFromSuperview()   containerView = nil   //any other code you need}