0
votes

I added ICarousel to my IOS project and it worked fine. I could scroll pictures.

Then my view contain another data. So I needed to add a UISCrollView wich cover all my view. So, now, I have some elements (labels, textViews, and the UIVIew for ICarousel) in my ScrollView.

The ScrollView works fine. But now, the ICarousel doesn't switch pictures. Pictures are loaded (I see the first one and a part of the second one) but the carousel doesn't work anymore.

Did someone have the same problem? How to solve it?

Edit:

After @Wain advices, I tried this:

- (void)viewDidLoad
{
    UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
    [self.view addGestureRecognizer:panRecognizer];

    panRecognizer.delegate = self;   
}
- (void)pan:(id)sender {
    NSLog(@"Pan");
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;
}

It doesn't work, but I checked with a breakpoint, it ran shouldRecognizeSimultaneouslyWithGestureRecognizer method when I tried a horizontal scroll.

Where am I wrong?

1
Do you know if iCarousel uses UIGestureRecognizers or touchesBegan?Ryan Poolos

1 Answers

1
votes

Looks like a clash between gesture recognisers because, by default, only one can be active at any one time.

Not sure why your scroll view covers everything, but you should be able to make your controller the delegate of the gestures and implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: to allow them to recognise concurrently.


UIScrollView has a panGestureRecognizer property that you can access to set yourself as the delegate.

iCarousel is a bit different as it doesn't make the gesture available publicly so if setting the delegate on the scroll view doesn't work you can edit the carousel (which sets itself as the delegate) to implement the delegate method.