modocache / MDCSwipeToChoose

Swipe to "like" or "dislike" any view, just like Tinder.app. Build a flashcard app, a photo viewer, and more, in minutes, not hours!
MIT License
2.55k stars 421 forks source link

Swipe gesture should only affect front most view #88

Closed acegreen closed 9 years ago

acegreen commented 9 years ago

I noticed that if I swipe the top view slightly in a direction (enough to be able to touch the one below it) I can use my other finger ( while holding the first view with a finger) and influence the back view. Though swiping is not possible, the view is rotated and scaled when gesturing. Also the Like/Nope labels are fading in.

photo 2015-05-25 8 41 06 am

acegreen commented 9 years ago

I managed to solve this by setting:

self.backCardView.userInteractionEnabled = false ----- in the viewDidLoad self.backCardView.userInteractionEnabled = false ----- in the wasChosenWithDirection self.frontCardView.userInteractionEnabled = true ---- in the setFrontCardViewUpdate

This should be included from the get-go