设置tableView的数据源方法

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    //创建cell
    static NSString *ID = @"txl";
    
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
    }
    //设置cell数据
    lxrModel *lxrMdl = _array[indexPath.row];
    cell.textLabel.text = lxrMdl.name;
    cell.detailTextLabel.text = lxrMdl.num;
    
    return cell;

 

posted on 2015-10-08 22:01  ZMIOS  阅读(463)  评论(0)    收藏  举报