Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions PullToRefresh/PullToRefresh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ extension PullToRefresh {
var offset: CGFloat
switch position {
case .top:
offset = previousScrollViewOffset.y + scrollViewDefaultInsets.top
offset = previousScrollViewOffset.y

case .bottom:
if scrollView!.contentSize.height > scrollView!.bounds.height {
Expand Down Expand Up @@ -272,7 +272,6 @@ private extension PullToRefresh {
return
}

scrollView.contentOffset = previousScrollViewOffset
scrollView.bounces = false
UIView.animate(
withDuration: 0.3,
Expand Down Expand Up @@ -322,7 +321,7 @@ private extension PullToRefresh {
var isCurrentlyVisible: Bool {
guard let scrollView = scrollView else { return false }

return scrollView.normalizedContentOffset.y <= -scrollViewDefaultInsets.top
return scrollView.normalizedContentOffset.y <= 0
}

func bringRefreshViewToSuperview() {
Expand Down
2 changes: 1 addition & 1 deletion PullToRefreshDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

tableView.contentInset = UIEdgeInsets(top: 100, left: 0, bottom: 0, right: 0)
setupPullToRefresh()
}

Expand Down