Taptic in iOS 9

前端 未结 4 1540
-上瘾入骨i
-上瘾入骨i 2021-01-30 23:16

Can you use the taptic engine in iOS 9 with iPhone 6s? WatchOS2 and OS X have the ability to use the haptic engine, so I assumed it would be in iOS 9 too, but I coudn\'t find an

4条回答
  •  抹茶落季
    2021-01-30 23:53

    Yay, I had reverse engineered internal UIKit stuff and I found another (much simpler) way to actuate feedback via TapticEngine! We can just use AudioToolbox framework and several magic constants.

    import AudioToolbox
    
    AudioServicesPlaySystemSound(1519) // Actuate `Peek` feedback (weak boom)
    AudioServicesPlaySystemSound(1520) // Actuate `Pop` feedback (strong boom)
    AudioServicesPlaySystemSound(1521) // Actuate `Nope` feedback (series of three weak booms)
    

    Hope this helps!

提交回复
热议问题