summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatbir Tanda <satbirtanda@gmail.com>2019-07-31 13:47:10 -0700
committerSatbir Tanda <satbirtanda@gmail.com>2019-07-31 13:47:10 -0700
commite8aac24d9aad63e5f0fcbf60b810572d01a0f9ab (patch)
tree32a8b415a7ea288f7f93e00ed1a213a8b1c8491a
parent39dd2726e8d9429c8062330a5dc78a9df7ebadb1 (diff)
downloadsdl_ios-e8aac24d9aad63e5f0fcbf60b810572d01a0f9ab.tar.gz
Update SDLLockScreenViewController.m
Make recommended fix
-rw-r--r--SmartDeviceLink/SDLLockScreenViewController.m13
1 files changed, 8 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLLockScreenViewController.m b/SmartDeviceLink/SDLLockScreenViewController.m
index 1dd0657aa..afda3b4d4 100644
--- a/SmartDeviceLink/SDLLockScreenViewController.m
+++ b/SmartDeviceLink/SDLLockScreenViewController.m
@@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) IBOutlet UIImageView *arrowUpImageView;
@property (weak, nonatomic) IBOutlet UIImageView *arrowDownImageView;
@property (strong, nonatomic) SwipeGestureCallbackBlock dismissGestureCallback;
+@property (strong, nonatomic) UISwipeGestureRecognizer *swipeGesture;
@end
@@ -79,14 +80,16 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Swipe Gesture
- (void)addDismissGestureWithCallback:(SwipeGestureCallbackBlock)swipeGestureCallback {
- self.dismissGestureCallback = swipeGestureCallback;
- UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(sdl_didSwipeToDismiss:)];
- [swipeGesture setDirection: UISwipeGestureRecognizerDirectionDown];
- [self.view addGestureRecognizer:swipeGesture];
+ if (!self.swipeGesture) {
+ self.dismissGestureCallback = swipeGestureCallback;
+ self.swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(sdl_didSwipeToDismiss:)];
+ [self.swipeGesture setDirection: UISwipeGestureRecognizerDirectionDown];
+ [self.view addGestureRecognizer:self.swipeGesture];
+ }
}
- (void)removeDismissGesture {
- self.view.gestureRecognizers = [[NSArray alloc] init];
+ [self.view removeGestureRecognizer:self.swipeGesture];
}
- (void)sdl_didSwipeToDismiss:(UISwipeGestureRecognizer *)gesture {