简体   繁体   中英

How do i impelement touch End on uislider above the scroll view: iphone

In my app i have an UISlider on the scrollView,

I need to move the slider to the next ciel/flor/round value when user removes finger from the slider,

I implemented Touch delegate methods, begin & Cancel but these are not working on slider (may be due to the UIScroll view).

Touch on uiscroll view NOT Working

What to do?

considering your situation i suggest to use UITapGestureRecognizer . First set up the TapGestureRecognizer on init.

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[scrollView addGestureRecognizer:tap];

And then get the touches from following:

  - (void)tapRecognizer:(UITapGestureRecognizer *)gesture
  { 
    CGPoint touchPoint=[gesture locationInView:scrollView];
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM