diff --git a/ios/ViewController.h b/ios/ViewController.h index d64d973c77..d17de68c1c 100644 --- a/ios/ViewController.h +++ b/ios/ViewController.h @@ -10,7 +10,7 @@ #import "LocationHelper.h" @interface ViewController : GLKViewController + LocationHandlerDelegate, CameraFrameDelegate, UIGestureRecognizerDelegate> - (void)shareText:(NSString *)text; - (void)shutdown; diff --git a/ios/ViewController.mm b/ios/ViewController.mm index ca5148089b..fa0ce2f52b 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -192,6 +192,12 @@ extern float g_safeInsetBottom; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; } + UISwipeGestureRecognizer *mSwipeLeftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; + + [mSwipeLeftRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight)]; + + [[self view] addGestureRecognizer:mSwipeLeftRecognizer]; + GLKView* view = (GLKView *)self.view; view.context = self.context; view.drawableDepthFormat = GLKViewDrawableDepthFormat24; @@ -250,6 +256,17 @@ extern float g_safeInsetBottom; }); } +- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer +{ + if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) { + INFO_LOG(SYSTEM, "LEFT"); + } else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) { + INFO_LOG(SYSTEM, "RIGHT"); + } else { + INFO_LOG(SYSTEM, "OTHER SWIPE: %d", (int)recognizer.direction); + } +} + - (void)appWillTerminate:(NSNotification *)notification { [self shutdown]; @@ -753,7 +770,7 @@ void System_LaunchUrl(LaunchUrlType urlType, char const* url) { NSURL *nsUrl = [NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]]; dispatch_async(dispatch_get_main_queue(), ^{ - [[UIApplication sharedApplication] openURL:nsUrl] options:@{} completionHandler:nil]; + [[UIApplication sharedApplication] openURL:nsUrl options:@{} completionHandler:nil]; }); } diff --git a/ios/main.mm b/ios/main.mm index a51a65bc2e..28d1bdf6aa 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -560,3 +560,4 @@ int main(int argc, char *argv[]) return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class])); } } +