gpt4 book ai didi

ios - iPhone - 检测触摸并取消触摸?

转载 作者:行者123 更新时间:2023-11-29 05:01:14 27 4
gpt4 key购买 nike

我正在检测 UIView 上的触摸。在某些情况下,我希望能够取消触摸,以便 TouchsEnded 不会被调用。但是,touchesEnded 总是会被调用并不重要?

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (SOMETHING_SPECIAL)
{
[super touchesCancelled:touches withEvent:event];
}
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//I don't want it to get here if touches were canceled how can i do this?
}

- 在 TouchsEnded 中,我如何确定触摸是否被取消?

最佳答案

无论您的触摸是否被取消,

TouchesEnded 都会总是被调用,所以我建议改为确切地说:

   if (SOMETHING_SPECIAL)
{

}

在你的:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

关于ios - iPhone - 检测触摸并取消触摸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6893838/

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