5

の中に がありUICollectionViewUIViewControllerの内側と外側のジェスチャに応答するようにしUICollectionViewます。デフォルトでは、UICollectionViewはそれ自体の内側のジェスチャにのみ応答しますviewが、その外側のスワイプに応答させるにはどうすればよいviewですか?

デモ

ありがとう。

4

3 に答える 3

2

ネイラーの答えの迅速なバージョン、これはビューコントローラーで行われたすべてのジェスチャーをコレクションビューに転送します

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
    collectionView.touchesBegan(touches, withEvent: event)
}
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
    collectionView.touchesEnded(touches, withEvent: event)
}
override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
    collectionView.touchesCancelled(touches, withEvent: event)
}
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
    collectionView.touchesMoved(touches, withEvent: event)
}
于 2016-09-22T09:40:27.100 に答える