ealeksandrov / EAIntroView

Highly customizable drop-in solution for introduction views.
MIT License
3.76k stars 501 forks source link

Partially swiping then pressing on page control causes unintended behavior #201

Closed babramovitch closed 6 years ago

babramovitch commented 7 years ago

You can get unintended behavior in the following two scenarios

1) Begin swiping a page left/right and without removing your swipe finger click on the bottom left/right of the page control. It will action the click and when you remove your swipe finger it stutters around.

2) Press on the left/right of the bottom page control but don't remove your finger. Begin swiping and then remove your finger. It stutters around as well.

Not the biggest of issues, but we were worried about people unintentionally triggering the problem.

We solved it by removing/adding the selector when page scrolling begins. We tried disabling user interactions, but in scenario 2 you could still trigger the bug when you lifted your finger.

- (void)intro:(EAIntroView *)introView pageStartScrolling:(EAIntroPage *)page withIndex:(NSUInteger)pageIndex {
    [_intro.pageControl removeTarget:nil action:NULL forControlEvents:UIControlEventValueChanged];
}

- (void)intro:(EAIntroView *)introView pageEndScrolling:(EAIntroPage *)page withIndex:(NSUInteger)pageIndex {
    [_intro.pageControl addTarget:_intro action:@selector(showPanelAtPageControl) forControlEvents:UIControlEventValueChanged];
}
ealeksandrov commented 6 years ago

Thanks, confirmed bug and your solution works well! Adding it to the library.

ealeksandrov commented 6 years ago

Actually I found way to prevent it without additional actions in UIScrollView delegate (which will fire on every scroll) - check out 3e623411ac6895bd5dbca00010d76d81b51addc1. Still thanks for your suggestion and bringing it to my attention :)