在我的应用中,我允许用户从其照片库中播放实时照片。
为此,我使用以下内容:
@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
的正常行为吗,有没有办法禁用它?
答案 0 :(得分:-1)
PHLivePhotoViews具有一个名为PHLivePhotoViewPlaybackStyle的枚举属性,该属性确定回放是否应包括触觉反馈。
要在播放时禁用触觉反馈,请执行以下操作:
livePhotoView.startPlayback(with: .hint)
代替:
livePhotoView.startPlayback(with: .full)