문제

I have a Clear-like UITableView which contains multiple cells. Each cell has a UIPanGestureRecognizer attached and it works as expected, but I want the table view to recognize just one pan gesture recognizer, not multiple. I tried to use the gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: but it doesn't work. I think it's because it only affects multiple UIGestureRecognizers on the same view and not in multiple views.

I need some help. How can I make it?

도움이 되었습니까?

해결책

Keep a variable in the table view to indicate whether there is an active gesture or not. Set its value according to gesture state, that is UIGestureRecognizerStateBegan or UIGestureRecognizerStateEnded. Then, ignore touches when there is already one gesture that has not ended yet.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top