Cette question est liée à une autre question qui a été résolue: Dynamic UITableCellView height
Je voulais atteindre une hauteur de cellule dynamic, qui fonctionne en utilisant ce code:
import UIKit class MyTableViewController: UITableViewController { var ensortinges:Array<Ssortingng> = [Ssortingng]() override func viewDidLoad() { super.viewDidLoad() var i = 0 while i < 20 { ensortinges.append("\(i) Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor") i++; } self.tableView.rowHeight = UITableViewAutomaticDimension } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.ensortinges.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { //ask for a reusable cell from the tableview, the tableview will create a new one if it doesn't have any let cell = self.tableView.dequeueReusableCellWithIdentifier("basic_cell", forIndexPath: indexPath) as UITableViewCell var label = cell.viewWithTag(13) if let unwrappedLabel = label as? UILabel { unwrappedLabel.text = self.ensortinges[indexPath.row] } return cell } }
Cependant, lorsque j'ajoute l'indicateur de divulgation à chaque cellule
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
Je reçois ce résultat:
à gauche avec indicateur et à droite sans.
Vous pouvez order le repo de github de ce projet de test: https://github.com/ArtworkAD/DynamicCellTest
Des idées quoi de mal? J'utilise swift avec xcode 6.1 et iOS8.1
Le problème est que dans mon code d'origine j'avais:
self.tableView.estimatedRowHeight = 64
Et cela semble tout casser. Après avoir enlevé tout cela fonctionne comme prévu.