How to Start UITableView on the Last Cell?

前端 未结 8 1255
囚心锁ツ
囚心锁ツ 2020-11-30 01:43

In Apple\'s Messages app, when you click a correspondent\'s name and switch to the table view of the conversation (with balloons for each message), the table appears scrolle

8条回答
  •  温柔的废话
    2020-11-30 02:30

    Answer of @DyingCactus in Swift 3 & Swift 4:

        let lastRow: Int = self.tableView.numberOfRows(inSection: 0) - 1
        let indexPath = IndexPath(row: lastRow, section: 0);
        self.tableView.scrollToRow(at: indexPath, at: .top, animated: false)
    

提交回复
热议问题