【问题标题】:How to disable the Haptic Feedback when playing a Live Photo如何在播放实时照片时禁用触觉反馈
【发布时间】:2019-05-24 15:45:15
【问题描述】:

在我的应用中,我允许用户播放照片库中的实况照片。

为此,我使用以下方法:

@IBOutlet weak var livePhotoView: PHLivePhotoView!

@objc func handleTapGesture(_ recognizer: UITapGestureRecognizer) {
    if let currentType = currentMediaType {
        if currentType == .livePhoto && livePhotoIsPlaying == false {
            playImageView.alpha = 0
            backButtonView.alpha = 0
            ivePhotoView.startPlayback(with: .full)
            livePhotoIsPlaying = true
        } else if currentType == .livePhoto && livePhotoIsPlaying == true {
            livePhotoView.stopPlayback()
            livePhotoIsPlaying = false
        }
    }
}

通过使用这种方法,每当播放我不想要的实况照片时,我都会收到触觉反馈。这是PHLivePhotoView的正常行为吗,有没有办法禁用它?

【问题讨论】:

    标签: ios swift haptic-feedback phlivephoto


    【解决方案1】:

    PHLivePhotoViews 有一个名为 PHLivePhotoViewPlaybackStyle 的枚举属性,用于确定播放是否应包含触觉反馈。

    要禁用播放时的触觉反馈:

    livePhotoView.startPlayback(with: .hint)
    

    代替:

    livePhotoView.startPlayback(with: .full)
    

    【讨论】:

    • 这完全改变了播放的内容。问题是关于在播放完整照片时消除触觉。
    • 即使有人想使用hint,它实际上也不会禁用触觉。
    猜你喜欢
    • 1970-01-01
    • 2015-12-26
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    • 2017-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多