UISwipeActionPullView overlaps UITableViewHeaderFooterView

Originator:MichalKaluzny
Number:rdar://38955479 Date Originated:28-Mar-2018 03:56 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.2
Classification:UI/Usability Reproducible:Always
 
Summary:
When an UISwipeActionPullView is being added to the UITableView it’s added above all the other subviews. This may result in overlapping the pinned header view of an UITableView in certain scenarios.

Steps to Reproduce:
1) Create a table view with headers and editActions for cells
2) Populate it with enough rows to span the whole screen
3) Scroll it up, so at least one of the cells is hidden partially behind a header view.
4) Swipe the partially covered cell to the left

Expected Results:
5) UISwipeActionPullView should be added below the UITableViewHeaderFooterView

Actual Results:
5) UISwipeActionPullView is added above the UITableViewHeaderFooterView

Version:
11.2

Notes:
I’ve fixed this by overriding UITableView’s addSubview method:

class FixedTableView: UITableView {
    override func addSubview(_ view: UIView) {
        if String(describing: type(of: view)) == "UISwipeActionPullView" {
            let header = subviews.first { $0 is UITableViewHeaderFooterView }
            if let firstHeader = header {
                self.insertSubview(view, belowSubview: firstHeader)
            } else {
                super.addSubview(view)
            }
        } else {
            super.addSubview(view)
        }
    }
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!