1

我以前使用以下代码来更改使用自定义的单元格的大小UITableViewCell

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 61;
}

但是,我在不同的视图上创建了一个新视图,并且从未调用过上面的代码。

UITableViewCell实际上是一个更通用视图的控件,但是所有其他类似的方法cellForRowAtIndexPath等都是

4

4 回答 4

1

delegate除了dataSource. _ 它们是两个独立的协议,这很容易被忽视。

于 2009-04-06T14:43:42.813 回答
0

Seems I needed this as well

- (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier {

    CGRect CellFrame = CGRectMake(0, 0, 300, 60);

    UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];

    return cell;
}
于 2009-04-06T16:04:05.240 回答
0

此外,您可以通过调整 UITableView(而不是 UITableViewCell)上的值在 IB 中完成同样的事情(我认为)。

于 2009-04-06T16:15:39.473 回答
0

heightForRowAtIndexPath 只是一个 UITableView 委托方法,而不是 UITableViewCell 方法。

因此,您将在委托类中拥有该代码,而不是在表格单元格代码中。

于 2009-04-06T19:46:00.357 回答