Skip to content

Solve the gesture conflict between multiple scrollView. ScrollView嵌套时,相同方向时的手势冲突的解决方案

License

Notifications You must be signed in to change notification settings

KiritoBeater/KBScrollMagic

Repository files navigation

KBScrollMagic

CI Status Version License Platform

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嵌套时,相同方向时的手势冲突的解决方案

gif picture

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8 +
  • Xcode 8
  • Swift 3

Installation

KBScrollMagic is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "KBScrollMagic"

Usage

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
}

Author

Kirito, 1353137283@qq.com

License

KBScrollMagic is available under the MIT license. See the LICENSE file for more info.

About

Solve the gesture conflict between multiple scrollView. ScrollView嵌套时,相同方向时的手势冲突的解决方案

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published