是触觉吗如果是这样,我该怎么办?
解决方法 例如 swift(对于iPhone 6S)import AudioToolBoxAudioServicesPlaySystemSound(1519) // Actuate `Peek` Feedback (weak boom)AudioServicesPlaySystemSound(1520) // Actuate `Pop` Feedback (strong boom)AudioServicesPlaySystemSound(1521) // Actuate `nope` Feedback (serIEs of three weak booms)
以防万一 – 这里是iPhone 7/7+的例子
对于强力触摸 – 您需要首先检测是否可用:
func is3dtouchAvailable(traitCollection: uitraitcollection) -> Bool { return traitCollection.forcetouchCapability == UIForcetouchCapability.available}
然后在触摸事件中它将以touch.force的形式提供
func touchmoved(touch: UItouch,topoint pos: CGPoint) { let location = touch.location(in: self) let node = self.atPoint(location) //... if is3dtouchEnabled { bubble.setPressure(pressurePercent: touch.force / touch.maximumPossibleForce) } else { // ... }}
以下是代码示例的更详细示例:
http://www.mikitamanko.com/blog/2017/02/01/swift-how-to-use-3d-touch-introduction/
以上是内存溢出为你收集整理的ios9 – ios 9 iphone 6S播放触觉反馈或振动全部内容,希望文章能够帮你解决ios9 – ios 9 iphone 6S播放触觉反馈或振动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)