![](/img/trans.png)
[英]Swift 3: CollectionView didSelectItemAt get selected cell label
[英]Swift CollectionView didSelectItemAt no longer working after overriding touch in cell
我想在我的CustomCollectionViewCell
上有一個tapAnimation
,所以我在class
添加了這些行:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
UIView.animate(withDuration: 0.05, delay: 0, options: .curveEaseInOut) {
self.theView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
}
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
UIView.animate(withDuration: 0.1, delay: 0, options: .curveEaseInOut) {
self.theView.transform = CGAffineTransform(scaleX: 1, y: 1)
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
UIView.animate(withDuration: 0.1) {
self.theView.transform = CGAffineTransform(scaleX: 1, y: 1)
}
}
theView
幾乎是這里的整個cell
。 但是在添加這個之后,我的collectionView
didSelectItemAt
不再觸發。 知道我在這里做錯了什么嗎? 它在沒有override
-snippets 的情況下工作。
補充:我實際上想要一個像 App-Store 中的動畫(只有點擊動畫,沒有過渡!)
如果您需要更多信息,請告訴我!
super
。前任:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.