-
让控制器实现数据源的代理
-
实现UITableViewDataSource 里面两个必须的方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; //告诉tableview 有多少行数据
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath //每行cell 所需要展示的数据
- 考虑对tableview的性能 需要进行复用cell
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:ID];
if(!cell){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
}