zoukankan      html  css  js  c++  java
  • iOS_OC UITableView 知识点

    1.插入新的数据并显示

      -(void)insertTableView:(Model *)model {

          NSMutableArray *indexPaths = [[NSMutableArray alloc] init];

          NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_dataSource.count inSection:0];  //创建新的NSIndexPath

          [indexPaths addObject:indexPath];  //增加到NSMutableArray中去

          [_dataSource addObject:model];    //UITableView 数据源更新数据

          [tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic];  //将新的行增加到表中

          [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];   //将表滑动到最后一行

      }

  • 相关阅读:
    tensorflow 学习
    join-semi and join-anti
    深入拆解Tomcat_Jetty 笔记
    Set化
    DDD实战-笔记
    高并发系统设计-笔记
    技术管理
    性能调优-笔记
    程序员是如何思考的-笔记
    LeetCode
  • 原文地址:https://www.cnblogs.com/lizhen24/p/6015508.html
Copyright © 2011-2022 走看看