Как можно автоматически прокрутить до конца 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 mapStr = ""
let data = self.dataArr[indexPath.row] as! [String:AnyObject]
let message = String(describing: data["message"]!)
let array = message.components(separatedBy: "\n") as! [String]
let arrayLoc = message.components(separatedBy: "Location: ") as! [String]
if arrayLoc.count > 0 {
mapStr = arrayLoc[1]
}
print(mapStr)
if mapStr.count > 0 {
self.open(scheme: mapStr)
}
}
}