UITablewView Свернуть Скорость анимации - PullRequest
0 голосов
/ 21 января 2019

Следующие разделы перемещаются слишком быстро и перекрывают свертывающийся раздел.

Следовали этому руководству https://www.youtube.com/watch?v=ClrSpJ3txAs

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    if indexPath.row == 0{
        if tableViewData[indexPath.section].opened == true {
            tableViewData[indexPath.section].opened = false
            let sections = IndexSet.init(integer: indexPath.section)
            tableView.reloadSections(sections, with: .none)

        }else{
            tableViewData[indexPath.section].opened = true
            let sections = IndexSet.init(integer: indexPath.section)
            tableView.reloadSections(sections, with: .none)

        }
    }
}

initial expanded collapsing1 overlappede

1 Ответ

0 голосов
/ 21 января 2019

Вы всегда можете встроить обновление табличного представления в блок анимации, тем самым контролируя его продолжительность. Например:

UIView.animate(withDuration: durationInSeconds) {
  tableView.reloadSections(sections, with: .none)
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...