我试图让视频播放器通过捏合来关闭,但没有任何成功。
func playVideo(video: MyVideoClass) {
let playerVC = AVPlayerViewController()
playerVC.player = AVPlayer(URL: NSURL(string: video.videourl)!)
let pinchy = UIPinchGestureRecognizer(target: self, action: "handlePinchGesture:")
playerVC.view.addGestureRecognizer(pinchy)
self.presentViewController(playerVC, animated: true, completion: {
playerVC.player!.play()
});
}
func handlePinchGesture(sender: AnyObject) {
print("Received gesture from \(sender)");
}
捏视频播放器UI此时无效。
答案 0 :(得分:2)
我过去通过在视频播放器上放置一个透明的UIView
解决了这个问题。我将捏合手势添加到透明UIView
,当它被处理时,我解除了它下面的视频播放器。