IOS中的table的写法的一些解释

在表格中显示单元格

  1. 在项目导航器中,选择 XYZToDoListViewController.m

  2. 找到 tableView:cellForRowAtIndexPath: 数据源方法。模板实现是这样的:

    1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    2. {
    3. static NSString *CellIdentifier = @"Cell";
    4. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    5. // Configure the cell...
    6. return cell;
    7. }

    该模板执行多个任务。它会创建一个变量来保存单元格的标识符,向表格视图请求具有该标识符的单元格,添加一个注释注明配置该单元格的代码应该写在哪里,然后返回该单元格。

posted @ 2014-11-10 15:33  memorecool  阅读(181)  评论(0编辑  收藏  举报