Library cell selection actions

This commit is contained in:
Chris Li 2017-02-24 11:42:10 -05:00
parent 5d651c7a83
commit 4698d52195
3 changed files with 14 additions and 1 deletions

View File

@ -203,6 +203,14 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
return header
}
// MARK: - UICollectionView Delegate
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
collectionView.deselectItem(at: indexPath, animated: true)
guard let cell = collectionView.cellForItem(at: indexPath) as? LibraryCollectionCell else {return}
didTapMoreButton(cell: cell)
}
// MARK: - UICollectionViewDelegateFlowLayout
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

View File

@ -86,7 +86,6 @@
</button>
</subviews>
</view>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<constraints>
<constraint firstItem="Wbk-Lp-yTb" firstAttribute="centerY" secondItem="Aea-Om-Uku" secondAttribute="centerY" id="3Lj-sz-46B"/>
<constraint firstAttribute="trailingMargin" secondItem="nTw-d7-YqD" secondAttribute="trailing" id="5JR-74-PhA"/>

View File

@ -187,6 +187,12 @@ class LibraryCollectionCell: UICollectionViewCell {
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var hasPicLabel: UILabel!
@IBOutlet weak var moreButton: UIButton!
override var isSelected: Bool {
didSet {
backgroundColor = isSelected ? UIColor(colorLiteralRed: 200/255, green: 220/255, blue: 1, alpha: 1) : UIColor.clear
}
}
}