Explorar o código

Playback View: add pinch gesture to leave media playback

Felix Paul Kühne %!s(int64=12) %!d(string=hai) anos
pai
achega
8c318853a9
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  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)