0

I work with UITableView with cell that hold label with numberOfLines = 0, it means that cell can show 1 line or 20 lines.

my problem is that the scroll not smooth.

** estimatedRowHeight didn't helped.

class SingleTopicControllerV2: UITableViewDelegate, UITableViewDataSource {

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = self.table.dequeueReusableCell(withIdentifier: self.cellId, for: indexPath) as! ReplyCellV2
    cell.delegate = self
    cell.setupCellWithReply(reply: reply, user: self.user, index: indexPath.row)
    return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

}

class ReplyCellV2: UITableViewCell {
func setupCellWithReply(reply: Reply, user: CurrensUserRealm, index: Int) {
    self.index = index

    if RealmService.shared.realm {
        self.reply = reply
        self.usernameBtn.setTitle(reply.owner.firstName, for: .normal)
        self.contentLabel.text = reply.content
        self.dateLabel.text = reply.time
    }
    self.setupRole(roleStr: reply.owner.role)
}
}
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
Hen Shabat
  • 519
  • 1
  • 6
  • 19

0 Answers0