瀏覽代碼

Playback View: add pinch gesture to leave media playback

Felix Paul Kühne 12 年之前
父節點
當前提交
8c318853a9
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      AspenProject/VLCMovieViewController.m

+ 10 - 0
AspenProject/VLCMovieViewController.m

@@ -111,6 +111,10 @@
 
     _displayRemainingTime = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCShowRemainingTime] boolValue];
 
+    UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
+    pinchRecognizer.delegate = self;
+    [self.view addGestureRecognizer:pinchRecognizer];
+
 #if 0 // FIXME: trac #8742
     UISwipeGestureRecognizer *leftSwipeRecognizer = [[VLCHorizontalSwipeGestureRecognizer alloc] initWithTarget:self action:nil];
     leftSwipeRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
@@ -402,6 +406,12 @@
 
 #pragma mark - controls visibility
 
+- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
+{
+    if (recognizer.velocity < 0.)
+        [self closePlayback:nil];
+}
+
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
 {
     if (touch.view != self.view)