2
我有tableView,当我键入我想要自动高度单元格。但我不知道如何解决它。我的第一个想法是:添加文本后的自动高度单元格
self.chatTableView.cellForRowAtIndexPath(indexPath)?.textLabel?.text = new_char
self.chatTableView.cellForRowAtIndexPath(indexPath)?.sizeToFit()
self.chatTableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)
当我有.sizeToFit()
我的结果这一行看起来是这样的: 但是,当我评论这行:
self.chatTableView.cellForRowAtIndexPath(indexPath)?.textLabel?.text = new_char
self.chatTableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)
有什么方法可以解决它?
我可以直接添加文本到单元格:) – Wraith
好的,那么你添加的文本不同于我做的。甚至更好;-) – joern