Skip to content

Instantly share code, notes, and snippets.

@incanus

incanus/ios.diff Secret

Created October 4, 2016 20:59
Show Gist options
  • Save incanus/fb2ffe1b235c9a132cd9d51dcfb369dd to your computer and use it in GitHub Desktop.
Save incanus/fb2ffe1b235c9a132cd9d51dcfb369dd to your computer and use it in GitHub Desktop.
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index feebb59..66a8158 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -170,6 +170,20 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
}
[self presentViewController:alertController animated:YES completion:nil];
}
+
+ [self performSelector:@selector(addTestShapes) withObject:nil afterDelay:1];
+}
+
+- (void)mapViewRegionIsChanging:(MGLMapView *)mapView
+{
+ CLLocationCoordinate2D center = mapView.centerCoordinate;
+ CLLocationCoordinate2D coordinates[2] = {
+ CLLocationCoordinate2DMake(45, -122),
+ center
+ };
+
+ MGLPolyline *line = (MGLPolyline *)mapView.annotations.firstObject;
+ [line updateCoordinates:coordinates count:2];
}
- (void)saveState:(__unused NSNotification *)notification
@@ -539,6 +553,24 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
- (void)addTestShapes
{
+ CLLocationCoordinate2D center = self.mapView.centerCoordinate;
+ CLLocationCoordinate2D lineCoordinates[2] = {
+ CLLocationCoordinate2DMake(45, -122),
+ center
+ };
+ MGLPolyline *line = [MGLPolyline polylineWithCoordinates:lineCoordinates count:2];
+ [self.mapView addAnnotation:line];
+
+// CLLocationCoordinate2D polygonCoordinates[3] = {
+// CLLocationCoordinate2DMake(44, -122),
+// CLLocationCoordinate2DMake(46, -122),
+// center
+// };
+// MGLPolygon *shape = [MGLPolygon polygonWithCoordinates:polygonCoordinates count:3];
+// [self.mapView addAnnotation:shape];
+
+ return;
+
// Pacific Northwest triangle
//
CLLocationCoordinate2D triangleCoordinates[3] =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment