disable swipe gesture for iCarousel

819 views Asked by At

I am using iCarousel to display an array of images and I want to disable the swipe gesture. I did not find that in the documentation. not sure if this is doable or not

3

There are 3 answers

0
Nimit Parekh On BEST ANSWER

If you want to disable the swipe gesture then I think are you want to do something like programatically change the image.

For very simply disable the user interaction of carousel.

If you using storyboard then simple remove checkmark of User Inreaction Enabled

enter image description here

If you use by code then following code to disable the User Inreaction Enabled

yourcarousel.userInteractionEnabled = FALSE;

May this help lot to solve your problem.

3
Achal Gandhi On

@Junchao GU If you are Using

https://github.com/nicklockwood/iCarousel

They are using Tap gesture and pan gesture You have to Comment

    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)];
panGesture.delegate = (id <UIGestureRecognizerDelegate>)self;
[_contentView addGestureRecognizer:panGesture];

//add tap gesture recogniser
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap:)];
tapGesture.delegate = (id <UIGestureRecognizerDelegate>)self;
[_contentView addGestureRecognizer:tapGesture];

in iCarousel.m File

I hope this will help you

0
Vlad Pulichev On

It's bad idea to change source code of iCarousel. I think it's better to do next:

carouselView.contentView.gestureRecognizers?.removeAll()

Hope it helps to someone