zoukankan      html  css  js  c++  java
  • 加载更多时,判断tableView快要滑动到底部的时候在去请求更多数据的公式

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView
    {
        /*
         // 判断是否需要加载更多
         // 判断等于0可以防止没有数据就显示加载更多控件
         // 判断底部视图是否隐藏可以防止重复加载
         if (self.statuses.count == 0 ||
         self.tableView.tableFooterView.hidden == NO) {
         return;
         }
         // 如果当前的偏移位等于 contentSize.height + contentInset.bottom - scrollView.height; 那么就需要加载更多数据
         // 如果当前的偏移位等于 scrollView能够滚动的高度 + 底部额外的扩展区域 - scrollView的高度, 那么就需要加载更多数据
         CGFloat offsetY = scrollView.contentSize.height + scrollView.contentInset.bottom - scrollView.height;
         if (scrollView.contentOffset.y >= offsetY) {
         self.tableView.tableFooterView.hidden = NO;
         DDLogDebug(@"加载更多数据");
         [self loadMoreStatuses];
         }
         */
        
        CGFloat offsetY = scrollView.contentSize.height + scrollView.contentInset.bottom - scrollView.height;
        if (scrollView.contentOffset.y >= offsetY)
        {
            self.tableView.tableFooterView.hidden = NO;
            
            NSLog(@"加载更多");
        }
    }
  • 相关阅读:
    EasyUI DataGrid undefined处理
    EasyUI Tabs
    EasyUI ComboBox ajax
    Spring Controller RequestMapping
    Spring前台填充数据
    关于Map集合的遍历总结
    mvc与三层结构终极区别
    关于cron4j的使用
    中国各个省市县的人口统计,echart展示
    windows 安装nodejs 和 npm
  • 原文地址:https://www.cnblogs.com/fs-ios/p/4998089.html
Copyright © 2011-2022 走看看