Kenneth Kenneth - 5 months ago 42
Swift Question

UIPageControl for Swiping Only

I am using a UIPageControl connected to a paging UIScrollView (all programmatically). I want to only allow the user to swipe through the pages.

The UIPageControl currently properly updates in the UIScrollViewDelegate's

scrollViewDidScroll
. However when you tap on the UIPageControl, the enabled dot jumps ahead one (which is the desired behavior for the home screen, etc but I do not want this tap to advance feature possible).

I want to prevent this behavior, but I can't find a way to easily disable it.

Answer

pageControl.userInteractionEnabled = false