打开页面后,如何自动滚动到UIViewController的底部?
当前,当我打开页面时,它一直滚动到顶部。但是我需要在底部,因为这是最新消息所在的位置
这是表格视图的快捷方式:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "messages") as! UITableViewCell
cell.selectionStyle = .none
let message = cell.viewWithTag(100) as! UILabel
let name = cell.viewWithTag(101) as! UILabel
let data = self.dataArr[indexPath.row] as! [String:AnyObject]
message.text = " " + String(describing: data["message"]!) + " "
name.text = String(describing: data["name"]!)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
var …Run Code Online (Sandbox Code Playgroud)