Fix collection view cells not deselecting in split nav controller on iPad
This commit is contained in:
parent
dcc8f38f3d
commit
1ac72bc363
|
@ -55,6 +55,12 @@ class SplitNavigationController: UIViewController {
|
||||||
if let tableVC = sender as? UITableViewController,
|
if let tableVC = sender as? UITableViewController,
|
||||||
let selectedIndexPath = tableVC.tableView.indexPathForSelectedRow {
|
let selectedIndexPath = tableVC.tableView.indexPathForSelectedRow {
|
||||||
tableVC.tableView.deselectRow(at: selectedIndexPath, animated: true)
|
tableVC.tableView.deselectRow(at: selectedIndexPath, animated: true)
|
||||||
|
} else if let sender = sender as? UIViewController,
|
||||||
|
let collectionView = sender.view as? UICollectionView {
|
||||||
|
// the collection view's animation speed is weirdly fast, so we do it slower
|
||||||
|
UIView.animate(withDuration: 0.5, delay: 0) {
|
||||||
|
collectionView.indexPathsForSelectedItems?.forEach { collectionView.deselectItem(at: $0, animated: false) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.rootNav.pushViewController(vc, animated: true)
|
self.rootNav.pushViewController(vc, animated: true)
|
||||||
|
|
Loading…
Reference in New Issue