Junchao Gu
Junchao Gu

Reputation: 1865

disable swipe gesture for iCarousel

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

Upvotes: 0

Views: 823

Answers (3)

Vlad Pulichev
Vlad Pulichev

Reputation: 3272

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

Upvotes: 1

Achal Gandhi
Achal Gandhi

Reputation: 151

@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

Upvotes: 2

Nimit Parekh
Nimit Parekh

Reputation: 16864

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.

Upvotes: 2

Related Questions