备忘
来源:互联网 发布:淘宝白菜群 编辑:程序博客网 时间:2024/06/05 02:15
- (void)setTableOffset:(UIScrollView *)scrollView{ CGFloat deltaY = scrollView.contentOffset.y - m_preOffsetY; CGFloat height = self.frame.size.height; CGFloat cellHeight = height - SECTION_HEADER_HEIGHT - SECTION_FOOTER_HEIGHT; if (deltaY < cellHeight / 2 && deltaY >= 0) { [scrollView setContentOffset:CGPointMake(0, m_preOffsetY) animated:YES]; } else if (deltaY >= cellHeight / 2) { [scrollView setContentOffset:CGPointMake(0, m_preOffsetY + cellHeight) animated:YES]; m_preOffsetY = m_preOffsetY + cellHeight; } else if (deltaY > -cellHeight / 2 && deltaY < 0) { [scrollView setContentOffset:CGPointMake(0, m_preOffsetY) animated:YES]; } else if (deltaY <= -cellHeight / 2) { [scrollView setContentOffset:CGPointMake(0, m_preOffsetY - cellHeight) animated:YES]; m_preOffsetY = m_preOffsetY - cellHeight; }}
- (void)setTableOffset:(UIScrollView *)scrollView{ NSInteger cellHeight = self.frame.size.height - SECTION_HEADER_HEIGHT - SECTION_FOOTER_HEIGHT; CGFloat deltaY = (NSInteger)self.contentOffset.y % cellHeight; NSInteger curIndex = self.contentOffset.y / cellHeight; BOOL isFullPage = [UPMathUtil isZero:deltaY precesion:0.1]; if (!isFullPage) { if (deltaY >= cellHeight / 2) { CGFloat offsetY = cellHeight * (curIndex + 1); // self.contentOffset = CGPointMake(0, offsetY); [self setContentOffset:CGPointMake(0, offsetY) animated:YES]; } else { CGFloat offsetY = cellHeight * curIndex; // self.contentOffset = CGPointMake(0, offsetY); [self setContentOffset:CGPointMake(0, offsetY) animated:YES]; } }}
0 0
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- 备忘
- sobel图像预处理
- centos安装mediawiki
- 全屏滑动返回手势
- 强烈推荐android studio用的几个插件
- springmvc初学时遇到问题,记录,省得自己以后再犯
- 备忘
- 并发编程实战手册-线程同步辅助类之CyclicBarrier
- JS初级学习笔记(2)
- 基础知识(七)opencv、python、人脸框检测
- BroadcastReceiver应用详解
- Redis介绍以及安装(Linux)
- Android开发者必知的开源库
- javascriptのsetTimeout和setInterval
- 网页一键分享按钮HTML代码