【发布时间】:2018-05-19 11:39:42
【问题描述】:
我正在为我的数据源使用 NSFetchedResultsController。
当我对单元格重新排序并且它向上或向下移动到屏幕上或稍微离开屏幕的位置时,单元格会通过动画移动到新位置。
但是,当该行移动到远离屏幕的新位置时,它只是在没有任何动画的情况下移动。
理想情况下,在这些情况下,我希望行向下或向上动画,直到它离开屏幕。有没有办法在不实现自定义方法的情况下实现这一点?
我在这里使用的案例是以下委托调用中的 .move:
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
switch type {
case .insert:
tableView.insertRows(at: [newIndexPath!], with: UITableViewRowAnimation.none)
case .delete:
tableView.deleteRows(at: [indexPath!], with: UITableViewRowAnimation.none)
case .update:
tableView.reloadRows(at: [indexPath!], with: UITableViewRowAnimation.none)
case .move:
tableView.moveRow(at: indexPath!, to: newIndexPath!)
}
}
【问题讨论】:
-
你试过
UITableViewRowAnimation.fade或类似的东西。 -
是的,这根本没有区别
标签: ios swift xcode uitableview nsfetchedresultscontroller