Skip to content

Commit

Permalink
Fixing content insets bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMosaad committed Feb 15, 2019
1 parent 8d8e116 commit 28586f0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/ParallaxPagerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ public final class ParallaxPagerView: UIView {
internalScrollView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: 0).isActive = true
internalScrollView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 0).isActive = true
internalScrollView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: 0).isActive = true
internalScrollView.bounces = scaleHeaderOnBounce
}

private func baseConfig() {
Expand Down Expand Up @@ -594,7 +593,7 @@ public final class ParallaxPagerView: UIView {

let constraintValue = headerHeightConstraint?.constant ?? 0
let height = max(constraintValue, headerHeight)
originalTopInset = height + tabsHeight
originalTopInset = scrollView.contentInset.top + height + tabsHeight
if #available(iOS 11.0, *) {
scrollView.contentInsetAdjustmentBehavior = .never
}
Expand All @@ -606,9 +605,9 @@ public final class ParallaxPagerView: UIView {
}
scrollView.contentInset = UIEdgeInsets(
top: originalTopInset,
left: CGFloat(0),
bottom: bottomInset,
right: CGFloat(0)
left: scrollView.contentInset.left,
bottom: bottomInset + scrollView.contentInset.bottom,
right: scrollView.contentInset.right
)
applyMinimumContentHeight(for: scrollView)
}
Expand Down

0 comments on commit 28586f0

Please sign in to comment.