slackhq / PanModal

An elegant and highly customizable presentation API for constructing bottom sheet modals on iOS.
MIT License
3.68k stars 531 forks source link

Delete space between TableView top anchor and tableHaderFooterViews top #188

Open alikenski opened 2 years ago

alikenski commented 2 years ago

Description

Have space between TableView top and tableHaderFooterViews top

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

I have a bug or smth like that. There is a space between TableView top and tableHaderFooterViews top. But I do not want to have this. In simulator all is okey and there are no space, but in real devices have space.

Reproducible in:

PanModal version: 1.2.7

iOS version: 16 beta, 15

Steps to reproduce:

1. 2. 3.

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

PanModalPresentable extension:

extension CouponListVC: PanModalPresentable {

    var panScrollable: UIScrollView? {
        tableView
    }

    var longFormHeight: PanModalHeight {
        tableView.layoutIfNeeded()
        let height = tableView.contentSize.height
        return .contentHeight(height)
    }

    var cornerRadius: CGFloat {
        24
    }

    var showDragIndicator: Bool {
        false
    }
}

Table View:

private lazy var tableView: UITableView = {
        let tbv = UITableView()
        tbv.allowsSelection = false
        tbv.separatorStyle = .none
        tbv.backgroundColor = Colors.secondaryGray
        tbv.showsVerticalScrollIndicator = false
        tbv.showsHorizontalScrollIndicator = false
        tbv.alwaysBounceVertical = false
        return tbv
    }()

Simulator:

Снимок экрана 2022-09-07 в 12 19 16

Real device: IMAGE 2022-09-07 12:24:10

View Hierarchy in XCode

Снимок экрана 2022-09-07 в 12 23 25
alikenski commented 2 years ago

I have found solution: Apple added padding in content top in iOS15:

 if #available(iOS 15, *) {
    tableView.sectionHeaderTopPadding = 0
}