- (UITableVIewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath这个函数实现的是为单元表提供数据的方法 设置了断点以后,发现这个函数每执行一次,indexPath就+1,但是并没有发现在哪里实现的+1 请问在哪里实现的呢??
UITableView有两个是必须执行的协议方法
第一个是:
//返回单元格个数,你返回是多少,他就执行多少次第二个协议
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
第二个是: //构建单元格 - (UITableVIewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
因此,没执行一次,他的indexPath就+1,一直执行到你返回的个数减去1(indexPath从0开始)