UITableViewController-01简单使用

UITableView-01基本使用
UITableView-02模型优化
UITableView-03复杂的Plist解析
UITableView-04常见属性和样式
UITableView-05Cell的性能优化

  • UITableVIewControlle的简单使用
    UITableViewController-01简单使用_第1张图片
    效果图
#pragma mark 数据源方法
//每行显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    cell.textLabel.text =[NSString stringWithFormat:@"第%zd组,第%zd行",indexPath.section,indexPath.row];
    
    return cell;
}

#pragma mark 代理方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"当前选中行,%zd",indexPath.row);
}

  • UITableViewControlle是什么?
    它其实就是UITableView的大管家, UITableViewControlle包含了UITableView,
  • tableView的数据源对象和代理对象,都是tableViewControlle.
  • UITableViewControlle中的view == tableView
    UITableViewController-01简单使用_第2张图片
  • 任何对象都可以成为UITableViewDataSource的代理对象.

你可能感兴趣的:(UITableViewController-01简单使用)