在UITableView

时间:2016-09-30 20:02:36

标签: ios objective-c uitableview

我创建了一个带有原型单元格的简单UITableView,我必须放大行的高度。不幸的是,我无法做到这一点。我只是在Interface Builder(Xcode)中为原型单元格设置高度的自定义大小,并将方法放在ViewController中:

-(float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 200.0;
}

cellForRowAtIndexPath方法:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    AlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"albumCellID"];

    if (cell == nil) {
        cell = [[AlbumCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"albumCellID"];
    }

    cell.albumTitle.text = [tableData objectAtIndex:indexPath.row];

    return cell;
}

模拟器返回我的表,行的高度仍然很小(约40像素)。如何扩大行的高度?

0 个答案:

没有答案
相关问题