2016-05-16 26 views
6

ho impostatoaltezza dinamica di UITableView Problema

self.tableView.estimatedRowHeight = 88.0 
self.tableView.rowHeight = UITableViewAutomaticDimension 

NumberOfLines Anche io ho fatto di UILabel a zero. Non ho dato alcun vincolo di altezza/larghezza fisso in IB. Ancora la mia altezza UITableviewCell non viene espansa di conseguenza.

Per favore suggeriscimi cosa fare.

risposta

6

Verificare se si sta definendo in modo esplicito tableView: metodo heightForRowAtIndexPath. In tal caso, rimuovere quel metodo o se si desidera utilizzarlo a causa di più celle esistenti, è possibile restituire UITableViewAutomaticDimension per quella specifica altezza della cella.

+0

Grazie amico mi ha salvato molto del mio tempo !! –

8

Try This:

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 
    return UITableViewAutomaticDimension 
} 

EDIT

func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 
    return UITableViewAutomaticDimension 
} 

Definire sopra Entrambi Methods.It risolvere il problema.

+0

Ho anche celle aggiuntive con altezze diverse. –

Problemi correlati