iOS taptic selectionChanged not firing for UISegmentedControl

问题描述 投票:0回答:0

我无法让 TapTic 引擎在与

.selectionChanged()
一起使用时生成
UISegmentedControl
,但它在
UISwitch

上完美运行

代码如下:

  @IBAction func languageSegmentedControlTouched(sender: UISegmentedControl)
  {
    self.tapticSelectionEngine?.prepare()
    
    DispatchQueue.main.async { self.setLanguage(languageOption: sender.selectedSegmentIndex) ; self.tapticSelectionEngine?.selectionChanged() }
  }

那什么都不做。

但这确实有效:

  @IBAction func movableToggleSwitchTouched(sender: UISwitch)
  {
    self.tapticSelectionEngine?.prepare()
    
    switch sender.isOn
    {
      case YES:
        
        self.tapticSelectionEngine?.selectionChanged()
        
        // Do stuff
                
      default:
        
        self.tapticSelectionEngine?.selectionChanged()
        
        // Do Stuff
    }
  }

如果我为影响版本替换 TapTic 引擎,那么它适用于分段控件,但我无法让选择版本工作,尽管 Apple 文档说这是我应该使用的版本。

我在没有异步调度的情况下尝试过,没有区别。我只是在阅读本教程后才尝试过:

iphone uisegmentedcontrol uiswitch selectionchanged taptic-engine
© www.soinside.com 2019 - 2024. All rights reserved.