Skip to content

Commit

Permalink
Select previously selected image when deselecting in multiselection
Browse files Browse the repository at this point in the history
  • Loading branch information
slashmo committed Feb 7, 2019
1 parent d950fa8 commit 65a4bad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/Pages/Gallery/YPLibraryVC+CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ extension YPLibraryVC {
}
}
v.collectionView.reloadItems(at: selectedIndexPaths)


// Replace the current selected image with the previously selected one
if let previouslySelectedIndexPath = selectedIndexPaths.last {
v.collectionView.deselectItem(at: indexPath, animated: false)
v.collectionView.selectItem(at: previouslySelectedIndexPath, animated: false, scrollPosition: [])
currentlySelectedIndex = previouslySelectedIndexPath.row
changeAsset(mediaManager.fetchResult[previouslySelectedIndexPath.row])
}

checkLimit()
}
}
Expand Down

0 comments on commit 65a4bad

Please sign in to comment.