我有一个avplayervewcontroller设置来播放视频,我正在一个自定义的视图控制器中嵌入VC的视图。
但如果用户尝试,他们可以通过2个手指抓取移动视频。如何禁用此功能?谢谢!
见下文:
最佳答案
开始播放视频之前,请尝试以下操作
var positions = [Int]()
for (idx, recognizer) in (playerVC.view.subviews[0].gestureRecognizers?.enumerated())! {
if recognizer is UIPinchGestureRecognizer || recognizer is UIPanGestureRecognizer {
positions.append(idx)
}
}
for position in positions {
playerVC.view.subviews[0].gestureRecognizers?.remove(at: position)
}