【问题标题】:What is the default "touch" event on the Apple UITabBarItem class?Apple UITabBarItem 类的默认“触摸”事件是什么?
【发布时间】:2012-10-10 12:40:19
【问题描述】:

我正在通过在默认 tabBar 顶部添加子视图并以编程方式触发所选事件来进行自定义 TabBar。它运作良好,但问题是我的 tabBar 与 Apple 的行为不完全相同: 在 Apple 默认设置中,如果您在不松开的情况下触摸(按下),它将选择选项卡,但不会在您触摸时立即选择(可能是 0.2 秒后)。

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

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

(我以为是Touch Down,但如果是,为什么会出现这种“延迟”?)

谢谢。

【问题讨论】:

    标签: objective-c ios cocoa-touch uitabbarcontroller uitabbaritem


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-09
      • 2018-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-05
      • 1970-01-01
      • 2015-11-07
      相关资源
      最近更新 更多