2012-03-22 24 views

Respuesta

42

Hay una función de delegado para la altura de UITableViewCell.

Aquí se especifica el indexPath de esa célula en particular y devolver su altura para que

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 
    if(indexPath.section == yourSection && indexPath.row == yourRow) { 
     return 150.0; 
    } 
    // "Else" 
    return someDefaultHeight; 
} 
2
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

Puede establecer el valor de la celda en una ruta de índice específica con este método y un valor predeterminado para las otras celdas.

7

Usted tendrá que saber, o averiguar qué índice de celda que desea hacer el más alto. Digamos que es su primera celda.

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 

    if (indexPath.row == 0) { //change 0 to whatever cell index you want taller 
     return 150; 
    } 
    else { 
     return 44; 
    } 
} 
3

RESPUESTA SWIFT

Especifique qué sección y fila que desea cambiar (recordemos el recuento comienza en 0, no 1) en el método heightForRowAtIndexPath.

override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat{ 
    if indexPath.section == 0 && indexPath.row == 0{ 
     return 150 
    } 
    return 44.0 
} 
Cuestiones relacionadas