iphone6s调用了错误的UIControlEvent方法

时间:2015-11-19 10:08:32

标签: ios objective-c uibutton uicontrolevents

我写了一个简单的演示来展示我的问题。按钮需要添加两个触摸事件:拖动和触摸。

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];

然后,

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

当我触摸iPhone6s / 6s中的按钮加上正常时间时,会调用这两种方法 但是当我触摸按钮很轻时,只调用第二种方法 当我使用iPhone6 / 6 plus,iPad和其他设备时,我触摸了按钮,只调用了第二种方法。

0 个答案:

没有答案