UIScrollView 的动画“下拉刷新”库。
您可以将动画“下拉刷新”操作添加到您的 UIScrollView、UITableView 和 UICollectionView。
灵感来源于 https://dribbble.com/shots/1797373-Pull-Down-To-Refresh
您可以在 appetize.io 上玩演示。
您可以通过 CocoaPods 将其安装到您的项目中。
pod 'PullToBounce'
// Please wrap your scroll view
tableView.frame = yourFrame
let tableViewWrapper = PullToBounceWrapper(scrollView: tableView)
// Please add wrapper view to your view instead of your scroll view.
bodyView.addSubview(tableViewWrapper)
包装器的边框将与您的 scrollView 相同。
并且颜色将与您的 scrollView 的背景颜色相同。
tableViewWrapper.didPullToRefresh = {
didFinishYourLoading() {
tableViewWrapper.stopLoadingAnimation()
}
}
init(
scrollView: UIScrollView, // this is the only required argument
bounceDuration: CFTimeInterval = 0.8,
ballSize:CGFloat = 36,
ballMoveTimingFunc: CAMediaTimingFunction = CAMediaTimingFunction(controlPoints:0.49,0.13,0.29,1.61),
moveUpDuration: CFTimeInterval = 0.25,
pullDistance: CGFloat = 96,
bendDistance: CGFloat = 40,
didPullToRefresh: (()->())? = nil
)
您可以使用这些参数来自定义动画。