当两个section的cell数量都为5的时候,方法的调用顺序:

-[ViewController numberOfSectionsInTableView:]
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 1
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 0

-[ViewController numberOfSectionsInTableView:]
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 1
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 0

-[ViewController numberOfSectionsInTableView:]
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 1
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:numberOfRowsInSection:], section = 0

-[ViewController tableView:cellForRowAtIndexPath:], section = 0, row = 0
-[ViewController tableView:cellForRowAtIndexPath:], section = 0, row = 1
-[ViewController tableView:cellForRowAtIndexPath:], section = 0, row = 2
-[ViewController tableView:cellForRowAtIndexPath:], section = 0, row = 3
-[ViewController tableView:cellForRowAtIndexPath:], section = 0, row = 4
-[ViewController tableView:cellForRowAtIndexPath:], section = 1, row = 0
-[ViewController tableView:cellForRowAtIndexPath:], section = 1, row = 1
-[ViewController tableView:cellForRowAtIndexPath:], section = 1, row = 2
-[ViewController tableView:cellForRowAtIndexPath:], section = 1, row = 3
-[ViewController tableView:cellForRowAtIndexPath:], section = 1, row = 4
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]
-[ViewController tableView:titleForHeaderInSection:]
-[ViewController tableView:titleForFooterInSection:]

以下会调用三次

返回section的num
{
最后一个section
返回section的header
返回section的footer
返回section的行数
从第一个section开始
返回section的header
返回section的footer
返回section的行数
}

section的数量  返回section的num{} 返回section的num{}的调用顺序 最后调用header、footer的次数
        1 三次 0 一组
        2 三次 1、0 两组
        3 三次 2、0、1 三组
        4 三次 3、0、1、2 四组
        5 三次 4、0、1、2、3 四组
        6 三次 5、0、1、2、3、4 四组

问题一:为什么到section数量4以后,最后调用header、footer的次数的次数都为4

解决:在屏幕大小内绘制tableView,绘制多少内容,调用相应方法(如果一个section只露出一个header和几个cell,那么会先调用header,然后调用 tableView:cellForRowAtIndexPath:方法)

   在设置的section内容之后,当前模拟器只能显示三个section(第三个section只有header露出来一点点,创建第一行cell和第二行cell,创建header和footer)

向下滑动,cell出现时,创建屏幕下下行cell(第一行cell出现,创建第三行cell)

  section的倒数第二行cell出现时,不创建

  section的最后一行cell的分界线出现时,创建下一个section的header

  section最后一行cell出现时,先创建下一个section的第一行cell,然后创建section的footer

  footer出现,不创建

下一个section的header出现时,创建下一个section的第二行cell

第一行cell出现时,创建第3行cell;

向上滑动,cell出现时,创建上一行cell(第二行cell出现,创建第一行cell)

  第二行cell出现,创建第一行cell

  第一行cell出现,不创建(plain模式,header还在头部)

  header被拖动,footer将出现时,创建footer

  footer出现,不创建

  header将出现时,创建上一个section的最后一行cell,然后创建header

  最后一行cell出现,创建倒数第二行;

问题二: 为什么“返回section的num{}”这一组方法每次都是调用三次?

tableView创建方法调用的研究的更多相关文章

  1. abap对象的创建和调用。方法调用

    1: abap中创建类和创建对象,调用方法. *&---------------------------------------------------------------------* ...

  2. 03_java基础(四)之方法的创建与调用

    import org.junit.Test; public class Main { public static void main(String[] args) { System.out.print ...

  3. 使用Swift开发iOS项目、UI创建、方法调用

    //1.root控制器的创建        var rootCtrl =RootViewController()        var root:UINavigationController =UIN ...

  4. java类.方法创建.继续调用

    1.ctrl +n 创建类(首字母大写) 2.alt +s 选倒数第二个 创建方法(Superclass) 3.alt +s 选倒数第三个 创建带参数的方法(using fileds) 4.创建的vo ...

  5. spring声明式事务 同一类内方法调用事务失效

    只要避开Spring目前的AOP实现上的限制,要么都声明要事务,要么分开成两个类,要么直接在方法里使用编程式事务 [问题] Spring的声明式事务,我想就不用多介绍了吧,一句话“自从用了Spring ...

  6. [转]Java远程方法调用

    Java远程方法调用,即Java RMI(Java Remote Method Invocation)是Java编程语言里,一种用于实现远程过程调用的应用程序编程接口.它使客户机上运行的程序可以调用远 ...

  7. tableview 代理方法详解

    typedef NS_ENUM(NSInteger, UITableViewCellAccessoryType) { UITableViewCellAccessoryNone, // 不显示任何图标 ...

  8. # 2017-2018-2 20155228 《信息安全系统设计原理》 使用VirtualStudio2008创建和调用静态库和使用VirtualC++6.0创建和调用动态库

    使用virtual c++ 6.0创建和调用动态库 不得不说一下关于环境的问题 只要我打一个响指,一半的安装在win7上的VC6.0都会因为兼容性问题直接崩掉 懒得研究怎么解决兼容性的问题了,直接开一 ...

  9. spring声明式事务 同一类内方法调用事务失效(转)

    原文 https://blog.csdn.net/jiesa/article/details/53438342 [问题] Spring的声明式事务,我想就不用多介绍了吧,一句话“自从用了Spring ...

随机推荐

  1. SVN简明使用方法 .

    SVN简明使用方法 TortoiseSVN 是 Subversion 版本控制系统的一个免费开源客户端,可以超越时间的管理文件和目录.文件保存在中央版本库,除了能记住文件和目录的每次修改以外,版本库非 ...

  2. Babelfish

    Time Limit: 1000MS Memory limit: 65536K 题目描述You have just moved from Waterloo to a big city. The peo ...

  3. 23个经典JDK设计模式(转)

    下面是JDK中有关23个经典设计模式的示例: Structural(结构模式) Adapter: 把一个接口或是类变成另外一种. o    ● java.util.Arrays#asList() o  ...

  4. Farm Irrigation(并查集)

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...

  5. 服务器之间免密码ssh登陆

    配置服务器f1(192.168.1.1)与服务器f2(192.168.1.2)之间免密码ssh登陆 一.首先,配置服务器主机名为f1.f2 1.更改/etc/sysconfig下的network文件, ...

  6. Java---类反射(2)---类反射加强

    经过前面的一篇博客,Java-类反射(1),相信大家对类反射有了一定的了解了. 下面来进行对类反射的加强,了解一下怎么通过类反射去new一个对象, 怎么通过类反射去访问其他类的方法. 怎么通过类反射去 ...

  7. HDOJ 1215 七夕节

    Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" ...

  8. [Locked] Group Shifted Strings

    Group Shifted Strings Given a string, we can "shift" each of its letter to its successive ...

  9. [AS/400] 基本概念

    本文内容源于 Go4AS400 在 AS/400 中,AS 代表着 Application System.AS/400 是一个安全性高的系统,可以限制用户只能访问.处理特定的信息.AS/400 整合了 ...

  10. poj 1269 水题

    题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath ...