mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-13 23:07:37 +10:00
fix logic of photoPickedImageView.hidden when scroll
This commit is contained in:
@@ -108,18 +108,23 @@ class PickPhotosViewController: UICollectionViewController, PHPhotoLibraryChange
|
||||
}
|
||||
|
||||
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(photoCellID, forIndexPath: indexPath) as! PhotoCell
|
||||
|
||||
cell.imageManager = imageManager
|
||||
|
||||
if let imageAsset = images[indexPath.item] as? PHAsset {
|
||||
cell.imageAsset = imageAsset
|
||||
cell.photoPickedImageView.hidden = !pickedImageSet.contains(imageAsset)
|
||||
}
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
override func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {
|
||||
|
||||
if let cell = cell as? PhotoCell {
|
||||
cell.imageManager = imageManager
|
||||
|
||||
if let imageAsset = images[indexPath.item] as? PHAsset {
|
||||
cell.imageAsset = imageAsset
|
||||
cell.photoPickedImageView.hidden = !pickedImageSet.contains(imageAsset)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
|
||||
|
||||
if let imageAsset = images[indexPath.item] as? PHAsset {
|
||||
|
||||
@@ -24,7 +24,6 @@ class PhotoCell: UICollectionViewCell {
|
||||
|
||||
self.imageManager?.requestImageForAsset(imageAsset, targetSize: CGSize(width: 80, height: 80), contentMode: .AspectFill, options: nil) { [weak self] image, info in
|
||||
self?.photoImageView.image = image
|
||||
self?.photoPickedImageView.hidden = !imageAsset.favorite
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user