GithubHelp home page GithubHelp logo

Comments (4)

nicklockwood avatar nicklockwood commented on May 28, 2024

Well spotted. It turns out subviews don't propagate events to their superview in quite the way I thought. This is now fixed (I've switched to using a UITapGestureRecognizer instead of a UIControl to detect the tap).

from icarousel.

andriyadi avatar andriyadi commented on May 28, 2024

Hi demosthenese,

Thanks for the fix. I confirm that the fix works.

However, related to didTap method. I suggest to change to something like this.

- (void)didTap:(UITapGestureRecognizer *)tapGesture
{
    ...

    if (index == self.currentItemIndex && [delegate respondsToSelector:@selector(carousel:didSelectItemAtIndex:)])
    {
        [delegate carousel:self didSelectItemAtIndex:index];
    }
}

When

centerItemWhenSelected
is enabled, clicking to non-centered item will make it centered and also trigger didSelectItemAtIndex. What I want is that item is only centered, not triggering didSelectItemAtIndex. Or maybe, there should be another flag to enable centering and selecting or just centering.

Thanks.

from icarousel.

nicklockwood avatar nicklockwood commented on May 28, 2024

I think it's more generally useful as it stands because some users may wish to be notified that an item is tapped even when auto-centering is on.

For your purposes you can simply put if (index == carousel.currentItemIndex) {...} in your delegate method to exclude taps on the non-selected items.

from icarousel.

andriyadi avatar andriyadi commented on May 28, 2024

That's cool. Thanks!

from icarousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.