let indexPath = IndexPath(row: 0, section: 2)
tableView.scrollToRow(at: indexPath, at: .bottom, animated: true)
func textViewDidChange(_ textView: UITextView) {
let currentOffset = tableView.contentOffset
UIView.setAnimationsEnabled(false)
tableView.beginUpdates()
tableView.endUpdates()
UIView.setAnimationsEnabled(true)
tableView.setContentOffset(currentOffset, animated: false)
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 5
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (section == 0) {
return 3
}
return 1
}
var count = 0
var timer = Timer()
func startPressed() {
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(counter), userInfo: nil, repeats: true)
}
func counter() {
count += 1
print(count)
if count == 5 {
let alert = UIAlertController(title: "Продолжить загрузку?", message: "Это может занять долгое время ...", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Да", style: .default, handler: { (UIAlertAction) in
}))
alert.addAction(UIAlertAction(title: "Нет", style: .default, handler: { (UIAlertAction) in
Здесь надо убить функцию
}))
self.present(alert, animated: true, completion: nil)
}
}
Клавиатура остается на месте и если писать ниже не видно то, что пишешь.