0

rowHeight が UITableView の高さに等しい 1 つのセルが必要です。Add 新しいセルを追加します。次に、roWHeight を持っているセルの総数で割ります。

私のviewDidLoadで、デフォルトの高さを設定しました。私は持っている:

myCellHeightNum = [[NSNumber alloc] initWithInt:100];
//not sure how to get the height of the UITableView so i set it to 100

私の-(IBAction) AddCell方法では:

[myTableView beginUpdates];
double value = [myCellHeightNum doubleValue];
myCellHeightNum = [NSNumber numberWithDouble:value * value / numOfCells];
 [myTableView reloadData];   

idk、どんなアイデアでも。

ありがとう、

ベン

4

2 に答える 2

1

この方法を使用する

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
于 2012-06-05T10:00:15.027 に答える
0

この関数を書く

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  double value = [myCellHeightNum doubleValue];
  myCellHeightNum = [NSNumber numberWithDouble:value * value / numOfCells];
  return [myCellHeightNum floatValue];
}
于 2012-06-05T12:38:24.870 に答える