Я пытаюсь заполнить UITableView UITableViewCell разной высоты. Я возвращаю правильный размер в
- (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath
Похоже, высота ячейки каким-то образом используется каркасом, но ячейки в очереди все еще имеют тот же размер.
Я также пытался использовать setFrame: для отдельных ячеек, но все же это не имеет никакого эффекта. Я что-то упустил
например
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (condition 1)
return 60;
else if (condition 2)
return 100;
return 44;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TableViewCell";
TableViewCell *cell = (TableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
return cell;
}