美文网首页
开发总结

开发总结

作者: ProgramTheApe | 来源:发表于2019-07-23 16:42 被阅读0次

YDSearchStoreCell *cell = [YDSearchStoreCell cellWithTableView:tableView];

cell.searchStoreFram = self.searchArray[indexPath.row];

return cell;


if (scrollView == self.tableView) {

// 保证我们是垂直方向滚动,而不是水平滚动

if (scrollView.contentOffset.x == 0) {

CGFloat y = scrollView.contentOffset.y;

// 这个是非常关键的变量,用于记录上一次滚动到哪个偏移位置

static CGFloat previousOffsetY = 0;

// 向上滚动

if (y > 0) {

if (self.collectStore.bottom <= 0) {

return;

}


CGFloat bottomY = self.collectStore.bottom - fabs(y - previousOffsetY);

bottomY = bottomY >= 0 ? bottomY : 0;

self.collectStore.bottom = bottomY;

self.typeView.y = self.collectStore.bottom;

self.tableView.frame = CGRectMake(0, self.typeView.bottom,

HKScreenW,

HKScreenH - 64 - self.typeView.bottom);

previousOffsetY = y;

// 如果一直不松手滑动,重复向上向下滑动时,如果没有设置还原为0,则会出现马上到顶的情况。

if (previousOffsetY >= self.collectStore.height) {

previousOffsetY = 0;

}

}


// 向下滚动

else if (y < 0) {

if (self.collectStore.y >= 0) {

return;

}

CGFloat bottomY = self.collectStore.bottom + fabs(y);

bottomY = bottomY <= self.collectStore.height ? bottomY : self.collectStore.height;

self.collectStore.bottom = bottomY;

self.typeView.y = self.collectStore.bottom;

self.tableView.frame = CGRectMake(0,

self.typeView.bottom,

HKScreenW,

HKScreenH - 64 - self.typeView.bottom);

}

}

}

相关文章

网友评论

      本文标题:开发总结

      本文链接:https://www.haomeiwen.com/subject/zijalctx.html