gpt4 book ai didi

ios - touchesEnd 未被调用位 touchesBegin 和 touchesMoved 确实被调用

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:56:09 27 4
gpt4 key购买 nike

我正在尝试在 ios 中进行拖动。如果拖动移动的距离很短,我将通过比较起始 x、y(从 touchesBegan 开始)与 touchesEnd 中的 x、y 来将拖动计为单击事件。似乎 touchesEnd 永远不会被调用。我设置了一个断点来验证它,断点从未消失。

code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];

[ self UpdateDrag];

}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];

}


- (void) touchesEnd:(NSSet *)touches withEvent:(UIEvent *)event {
// this methes never gets called
NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];


if (mDisplay==nil)
{
mDisplay = [[cDisplayYesOrNo_iPhone alloc]
initWithNibName:@"cDisplayYesOrNo_iPhone"
bundle:[NSBundle mainBundle]];
}
[ mDisplay SetUp];
[self presentModalViewController: mDisplay animated:NO];


}

最佳答案

关于ios - touchesEnd 未被调用位 touchesBegin 和 touchesMoved 确实被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18857736/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com