开发总结


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);

}

}

}

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容