Dillion/iOS-Flip-Transform

Both controlled and triggered actions on the one tranform

tobe-sta opened this issue · 2 comments

This is more a query than an issue, but I was wondering if you can assign a flip transform with both the controlled action and the triggered action. As I understand, you initialise the delegate with the transform type that you want to use. Is there any way of assigning both types of transform.

Thanks.

Hi, you will need to change some mappings. You can create 2 animation delegates, 1 controlled and 1 triggered, and assign them to the same flip view. Then have 2 gesture recognizers, each triggering their own animation delegate, which performs the transformation of the flip view.

Things you will need to take note of:

  1. If your gesture recognizers detect the same area, you need to make sure that they don't eat up the touches so that the other one can also detect
  2. After detecting, you need to handle the cases whereby the transformation is midway and decide whether or not to ignore the touch, i.e. after triggering a flip by a tap, before the flip ends, do you want to handle a panning gesture
  3. The flipview doesn't need an animation delegate assigned (i should tidy up that part), but the animation delegate needs a flipview assigned. So it should be ok to assign the same flip view to 2 delegates

An example scenario of the whole process would be, tapping to flip on the edge of the page and panning to flip on any part of the page. 2 gesture recognizers, one detecting the page edge for a tap, one detecting the page for a pan. If the tap gesture recognizer triggers, it calls the triggered sequence animation delegate, which performs a forward or backward flip. If the pan gesture recognizer triggers, it calls the controlled sequence animation delegate, which moves the page continuously until the pan gesture recognizer ends.

Thanks, I'll give it a go.