[vlc-devel] [PATCH] Fixes: Control playback with gestures

Christopher Loessl cloessl at x-berg.de
Thu May 29 11:44:49 CEST 2014


If the users disabled gestures and then started playback for the first
time, gesture recognizers weren't added to the viewController. If the
user now turned on gesture recognizers viewDidLoad wouldn't happen again
and the user had to kill the application to get gestures working.
---
 Sources/VLCMovieViewController.m | 54 +++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/Sources/VLCMovieViewController.m b/Sources/VLCMovieViewController.m
index 58c3356..d61a38d 100644
--- a/Sources/VLCMovieViewController.m
+++ b/Sources/VLCMovieViewController.m
@@ -237,34 +237,32 @@
     _displayRemainingTime = [[defaults objectForKey:kVLCShowRemainingTime] boolValue];
     _swipeGesturesEnabled = [[defaults objectForKey:kVLCSettingPlaybackGestures] boolValue];
 
-    if (_swipeGesturesEnabled) {
-        _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
-        _pinchRecognizer.delegate = self;
-        [self.view addGestureRecognizer:_pinchRecognizer];
-
-        _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
-        [_tapRecognizer setNumberOfTouchesRequired:2];
-        _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
-        [_panRecognizer setMinimumNumberOfTouches:1];
-        [_panRecognizer setMaximumNumberOfTouches:1];
-
-        _swipeRecognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
-        _swipeRecognizerLeft.direction = UISwipeGestureRecognizerDirectionLeft;
-        _swipeRecognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
-        _swipeRecognizerRight.direction = UISwipeGestureRecognizerDirectionRight;
-
-        [self.view addGestureRecognizer:_swipeRecognizerLeft];
-        [self.view addGestureRecognizer:_swipeRecognizerRight];
-        [self.view addGestureRecognizer:_panRecognizer];
-        [self.view addGestureRecognizer:_tapRecognizer];
-        [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
-        [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
-
-        _panRecognizer.delegate = self;
-        _swipeRecognizerRight.delegate = self;
-        _swipeRecognizerLeft.delegate = self;
-        _tapRecognizer.delegate = self;
-    }
+    _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
+    _pinchRecognizer.delegate = self;
+    [self.view addGestureRecognizer:_pinchRecognizer];
+
+    _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
+    [_tapRecognizer setNumberOfTouchesRequired:2];
+    _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
+    [_panRecognizer setMinimumNumberOfTouches:1];
+    [_panRecognizer setMaximumNumberOfTouches:1];
+
+    _swipeRecognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
+    _swipeRecognizerLeft.direction = UISwipeGestureRecognizerDirectionLeft;
+    _swipeRecognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
+    _swipeRecognizerRight.direction = UISwipeGestureRecognizerDirectionRight;
+
+    [self.view addGestureRecognizer:_swipeRecognizerLeft];
+    [self.view addGestureRecognizer:_swipeRecognizerRight];
+    [self.view addGestureRecognizer:_panRecognizer];
+    [self.view addGestureRecognizer:_tapRecognizer];
+    [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
+    [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
+
+    _panRecognizer.delegate = self;
+    _swipeRecognizerRight.delegate = self;
+    _swipeRecognizerLeft.delegate = self;
+    _tapRecognizer.delegate = self;
 
     _aspectRatios = @[@"DEFAULT", @"FILL_TO_SCREEN", @"4:3", @"16:9", @"16:10", @"2.21:1"];
 
-- 
1.8.5.2 (Apple Git-48)




More information about the vlc-devel mailing list