0

I wrote a simple demo to show my issue.The button need to be added two touch events:drag and touch.

UIButton * btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.frame = CGRectMake(300, 100, 100, 100);
btn1.backgroundColor = [UIColor redColor];
[btn1 addTarget:self action:@selector(stretchBtnDragMoving:withEvent:) forControlEvents:UIControlEventTouchDragInside];
[btn1 addTarget:self action:@selector(stretchBtnDragEnded:withEvent:) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside];
[self.view addSubview:btn1];

And then,

- (void)stretchBtnDragMoving:(UIControl *)control withEvent:(UIEvent *)event
{
    NSLog(@"moving");
}
- (void)stretchBtnDragEnded:(UIControl *)control withEvent:(UIEvent *)event
{
    NSLog(@"end or in");
}

When I touched the button in iPhone6s/6s plus like normal time,both of the methods be called.
But when I touched the button very light, only the second method be called.
When I used iPhone6/6 plus,iPad and other devices,however I touched the button,only the second method be called.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
michiko
  • 1
  • 1
  • I would guess different sensitivity on what is considered a drag. – Avi Nov 19 '15 at 10:10
  • 3D touch definitely changes certain way of iOS capturing your touch – zc246 Nov 19 '15 at 10:13
  • But how can I avoid the different sensitivity.Do you have some nice methods. @Avi – michiko Nov 19 '15 at 10:18
  • @zcui93 I closed the 3D touch,but the problem is still exist. – michiko Nov 19 '15 at 10:20
  • I think it's a mistake to use both events. If you were tracking the touches yourself, you could have your own threshold for what is considered a drag versus a touch. With the control events, you are stuck with whatever Apple implements. – Avi Nov 19 '15 at 10:32

0 Answers0