My Custom Button is not getting click in iCarousel iOS?

前端 未结 2 442
粉色の甜心
粉色の甜心 2020-12-18 11:25

In my example I am using iCarousel in which I am trying to expand image on clicking on it? What I have done,after image expands I am adding backButton on right

相关标签:
2条回答
  • 2020-12-18 12:05

    The button is probably outside the bounds of it's superview. iOS views can be drawn outside of their superview bounds, but won't receive touch events outside those bounds.

    If the button is inside the carousel, try enabling clipsToBounds on the iCarousel view to test the theory. If it's inside a carousel item view, try enabling clipsToBounds on your iCarousel item views.

    If it's inside the carousel, either move it outside, or just make the carousel frame bigger. But if it's inside an item view, you can't easily animate making individual carousel views bigger because of the way iCarousel works internally.

    In that case, to fix it, I suggest drawing your expanded view in front of the carousel rather than inside it. To make it easier to animate, you could animate the image zoom while inside the carousel as you are doing currently, but then move the view to the front of the superview hierarchy at the end of the animation, so the user doesn't see the switchover.

    0 讨论(0)
  • 2020-12-18 12:14

    I also had the same problem but I have resolved with below code.

    view.userInteractionEnabled = YES;
    

    view = your carousel view item

    OR

    [yourButton.superview setUserInteractionEnabled:YES];
    

    hope it helps to others.

    cheers!!!!

    0 讨论(0)
提交回复
热议问题