监控滑动偏移量实现微信消息列表底部效果:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if ([scrollView isEqual: self.tableView]) {
if (self.tableView.contentOffset.y >= self.tableView.contentSize.height) {
// 上滑
self.tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, kScreenHeight - NavigationHeigh - 57 * HMHeight);
}
else{
// 下滑
NSLog(@"Down");
self.tableView.frame = CGRectMake(0, 0, kScreenWidth,kScreenHeight -NavigationHeigh);
}
}
}


将self.tableView.contentSize.height 换成self.scrollView.contentOffset.y > bold 监控上面偏移度来实现自己想要的效果.如下图(Scrollview的backgroundColor为红色,白色为view高度。)


网友评论