Skip to content

Commit

Permalink
修复部分 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leejayID committed Jun 20, 2017
1 parent 866b52a commit 88bc4da
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Binary file not shown.
6 changes: 3 additions & 3 deletions Linkage/CollectionView/CollectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import "LeftTableViewCell.h"

static float kLeftTableViewWidth = 80.f;
static float kCollectionViewMargin = 2.f;
static float kCollectionViewMargin = 3.f;

@interface CollectionViewController () <UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegateFlowLayout,
UICollectionViewDataSource>
Expand Down Expand Up @@ -248,7 +248,7 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection
- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
{
// 当前CollectionView滚动的方向向上,CollectionView是用户拖拽而产生滚动的(主要是判断CollectionView是用户拖拽而滚动的,还是点击TableView而滚动的)
if (!_isScrollDown && collectionView.dragging)
if (!_isScrollDown && (collectionView.dragging || collectionView.decelerating))
{
[self selectRowAtIndexPath:indexPath.section];
}
Expand All @@ -258,7 +258,7 @@ - (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementa
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(nonnull UICollectionReusableView *)view forElementOfKind:(nonnull NSString *)elementKind atIndexPath:(nonnull NSIndexPath *)indexPath
{
// 当前CollectionView滚动的方向向下,CollectionView是用户拖拽而产生滚动的(主要是判断CollectionView是用户拖拽而滚动的,还是点击TableView而滚动的)
if (_isScrollDown && collectionView.dragging)
if (_isScrollDown && (collectionView.dragging || collectionView.decelerating))
{
[self selectRowAtIndexPath:indexPath.section + 1];
}
Expand Down
8 changes: 6 additions & 2 deletions Linkage/TableView/TableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section
{
// 当前的tableView是RightTableView,RightTableView滚动的方向向上,RightTableView是用户拖拽而产生滚动的((主要判断RightTableView用户拖拽而滚动的,还是点击LeftTableView而滚动的)
if ((_rightTableView == tableView) && !_isScrollDown && _rightTableView.dragging)
if ((_rightTableView == tableView)
&& !_isScrollDown
&& (_rightTableView.dragging || _rightTableView.decelerating))
{
[self selectRowAtIndexPath:section];
}
Expand All @@ -200,7 +202,9 @@ - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView
- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section
{
// 当前的tableView是RightTableView,RightTableView滚动的方向向下,RightTableView是用户拖拽而产生滚动的((主要判断RightTableView用户拖拽而滚动的,还是点击LeftTableView而滚动的)
if ((_rightTableView == tableView) && _isScrollDown && _rightTableView.dragging)
if ((_rightTableView == tableView)
&& _isScrollDown
&& (_rightTableView.dragging || _rightTableView.decelerating))
{
[self selectRowAtIndexPath:section + 1];
}
Expand Down

0 comments on commit 88bc4da

Please sign in to comment.