To run the example project, clone the repo, and run pod install from the Example directory first.
YBScrollSuspendManage is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'YBScrollSuspendManage'- (YBScrollSuspendManage *)suspendManage
{
if (!_suspendManage) {
_suspendManage = [YBScrollSuspendManage new];
_suspendManage.delegate = self;
}
return _suspendManage;
}YBGridViewController * gridVC = [YBGridViewController new];
gridVC.yb_suspendManage = self.suspendManage;- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
YBBaseTabelViewController * tabelViewController = [self.bookmarkView currentViewController];
//需要悬浮滚动的控制器
[self.suspendManage mainScrollViewDidScroll:scrollView subScrollView:tabelViewController.tableView forHeaderMaxY:200];
}//激活多手势
_tableView.yb_enableGestureScroll = YES;- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self.yb_suspendManage subScrollViewDidScroll:scrollView];
}#pragma mark - YBScrollSuspendManageDelegate
- (BOOL)enableSuspendForSubScroll:(UIScrollView *)subScrollView
{
CGRect rect = [self.bookmarkView convertRect:self.bookmarkView.bounds toView:self.view];
if (rect.origin.y <= 0) {
//需要悬浮
return YES;
}
return NO;
}Ethanbing, 380711712@qq.com
YBScrollSuspendManage is available under the MIT license. See the LICENSE file for more info.