KBScrollMagic is a solution for the gesture conflict between multiple scrollView when we have some scrollViews or tableViews that added to a superview that is also scrollView. Easy to use!
ScrollView嵌套时,相同方向时的手势冲突的解决方案
To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 8 +
- Xcode 8
- Swift 3
KBScrollMagic is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "KBScrollMagic"
easy use!
call the follow code at your scrollView that it's a subview of another scrollView
// superScrollView: 外层的ScrollView
// insetY: 上边部分的高度
// delegate: SuperScrollView有下拉刷新时,建议实现此代理
tableView.kbs.set(superScrollView: <UIScrollView>, insetY: <CGFloat>, delegate: <KBScrollMagicDelegate>)
OR
tableView.kbs.setSuperScrollView(<UIScrollView>)
tableView.kbs.setinsetY(<CGFloat>)
if the SuperScrollView need to PullToRefresh, implement the following code SuperScrollView有下拉刷新时,建议实现此代理
tableView.kbs.setDelegate(<KBScrollMagicDelegate>)
//protocol KBScrollMagicDelegate
func scrollMagicDidEndDrag(when superScrollView: UIScrollView, offSetY: CGFloat){
// call the RefreshCode
}
Kirito, 1353137283@qq.com
KBScrollMagic is available under the MIT license. See the LICENSE file for more info.