diff --git a/ios/MBXViewController.h b/ios/MBXViewController.h index a554a7261..35f46ccc9 100644 --- a/ios/MBXViewController.h +++ b/ios/MBXViewController.h @@ -6,9 +6,8 @@ // // -#import #import -@interface MBXViewController : GLKViewController +@interface MBXViewController : UIViewController @end \ No newline at end of file diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index 12f577d5c..3a9acdac1 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -10,6 +10,7 @@ #import "MBXSettings.h" +#import #import #import @@ -59,9 +60,9 @@ class MBXMapView llmr::Map map; }; -- (void)viewDidLoad +- (void)loadView { - [super viewDidLoad]; + [super loadView]; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; @@ -71,15 +72,23 @@ class MBXMapView return; } - mapView = new MBXMapView(); + GLKView *view = [[GLKView alloc] initWithFrame:[[UIScreen mainScreen] bounds] context:self.context]; - GLKView *view = (GLKView *)self.view; - view.context = self.context; + view.enableSetNeedsDisplay = NO; view.drawableStencilFormat = GLKViewDrawableStencilFormat8; [view bindDrawable]; [EAGLContext setCurrentContext:self.context]; + self.view = view; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + mapView = new MBXMapView(); + mapView->init(); UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; @@ -160,6 +169,8 @@ class MBXMapView elapsed = current; frames = 0; } + + [(GLKView *)self.view display]; } - (void)handlePanGesture:(UIPanGestureRecognizer *)pan