gpt4 book ai didi

objective-c - Apple UITabBarItem 类上的默认 "touch"事件是什么?

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

我正在通过在默认 tabBar 顶部添加 subview 并以编程方式触发所选事件来创建自定义 TabBar。它运行良好,但问题是我的 tabBar 的行为与 Apple 的不完全相同:在 Apple 的默认选项上,如果您触摸而不松开(按下),它会选择标签,但不会在您触摸时立即选择(可能会在 0.2 秒后)。

  • 如果我在我的自定义 TabBar 上放置一个 Touch Down 事件,它会立即触发该选项卡。
  • 如果我放置一个 Touch Up Inside 事件,它只会在发布时触发...

那么,Apple 在他的 TabBarItem 类(或者可能是父类)中使用的触摸事件是什么?

(我以为是 Touch Down,但如果是的话,为什么事件会有这种“延迟”?)

谢谢。

最佳答案

它可能正在使用 UILongPressGestureRecognizer。例如:

UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(longPressDetected:)];
longPressGR.delegate = self;
longPressGR.minimumPressDuration = 1.0;
[yourView addGestureRecognizer:longPressGR];

关于objective-c - Apple UITabBarItem 类上的默认 "touch"事件是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12819575/

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