summaryrefslogtreecommitdiff
path: root/ios/app
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-04-09 09:56:01 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-04-09 09:56:01 -0700
commitfc3802eddb679c040b7faaac0dc1b096cbc940a7 (patch)
tree4f3ba3fc27dd4b22e29db2e8757be8cc8ad3167b /ios/app
parentc0eee9565ed9f521136be7a145a34caf0a5e1dd2 (diff)
parentbe599fa385baf2bedd2d788737282c84d8737a0f (diff)
downloadqtlocation-mapboxgl-fc3802eddb679c040b7faaac0dc1b096cbc940a7.tar.gz
Merge pull request #1239 from friedbunny/locate-button
Add simple tracking mode button to demo app
Diffstat (limited to 'ios/app')
-rw-r--r--ios/app/MBXViewController.mm25
-rw-r--r--ios/app/img/TrackingHeadingMask.pngbin0 -> 250 bytes
-rw-r--r--ios/app/img/TrackingHeadingMask@2x.pngbin0 -> 467 bytes
-rw-r--r--ios/app/img/TrackingHeadingMask@3x.pngbin0 -> 672 bytes
-rw-r--r--ios/app/img/TrackingLocationMask.pngbin0 -> 407 bytes
-rw-r--r--ios/app/img/TrackingLocationMask@2x.pngbin0 -> 680 bytes
-rw-r--r--ios/app/img/TrackingLocationMask@3x.pngbin0 -> 903 bytes
-rw-r--r--ios/app/img/TrackingLocationOffMask.pngbin0 -> 493 bytes
-rw-r--r--ios/app/img/TrackingLocationOffMask@2x.pngbin0 -> 973 bytes
-rw-r--r--ios/app/img/TrackingLocationOffMask@3x.pngbin0 -> 1407 bytes
-rw-r--r--ios/app/img/locateUser.pngbin1111 -> 0 bytes
-rw-r--r--ios/app/img/locateUser@2x.pngbin1696 -> 0 bytes
-rw-r--r--ios/app/img/locateUser@3x.pngbin521 -> 0 bytes
13 files changed, 24 insertions, 1 deletions
diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm
index f4047c40f6..1d6b2d8cef 100644
--- a/ios/app/MBXViewController.mm
+++ b/ios/app/MBXViewController.mm
@@ -91,7 +91,7 @@ mbgl::Settings_NSUserDefaults *settings = nullptr;
[titleButton addTarget:self action:@selector(cycleStyles) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.titleView = titleButton;
- self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"locateUser.png"]
+ self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"TrackingLocationOffMask.png"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(locateUser)];
@@ -304,6 +304,29 @@ mbgl::Settings_NSUserDefaults *settings = nullptr;
return YES;
}
+- (void)mapView:(MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated
+{
+ UIImage *newButtonImage;
+
+ switch (mode) {
+ case MGLUserTrackingModeNone:
+ newButtonImage = [UIImage imageNamed:@"TrackingLocationOffMask.png"];
+ break;
+
+ case MGLUserTrackingModeFollow:
+ newButtonImage = [UIImage imageNamed:@"TrackingLocationMask.png"];
+ break;
+
+ case MGLUserTrackingModeFollowWithHeading:
+ newButtonImage = [UIImage imageNamed:@"TrackingHeadingMask.png"];
+ break;
+ }
+
+ [UIView animateWithDuration:0.25 animations:^{
+ self.navigationItem.rightBarButtonItem.image = newButtonImage;
+ }];
+}
+
#pragma clang diagnostic pop
@end
diff --git a/ios/app/img/TrackingHeadingMask.png b/ios/app/img/TrackingHeadingMask.png
new file mode 100644
index 0000000000..9ec0567a3f
--- /dev/null
+++ b/ios/app/img/TrackingHeadingMask.png
Binary files differ
diff --git a/ios/app/img/TrackingHeadingMask@2x.png b/ios/app/img/TrackingHeadingMask@2x.png
new file mode 100644
index 0000000000..0df8ccc229
--- /dev/null
+++ b/ios/app/img/TrackingHeadingMask@2x.png
Binary files differ
diff --git a/ios/app/img/TrackingHeadingMask@3x.png b/ios/app/img/TrackingHeadingMask@3x.png
new file mode 100644
index 0000000000..e4b93e42e7
--- /dev/null
+++ b/ios/app/img/TrackingHeadingMask@3x.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationMask.png b/ios/app/img/TrackingLocationMask.png
new file mode 100644
index 0000000000..bb7348c482
--- /dev/null
+++ b/ios/app/img/TrackingLocationMask.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationMask@2x.png b/ios/app/img/TrackingLocationMask@2x.png
new file mode 100644
index 0000000000..35c5a293ec
--- /dev/null
+++ b/ios/app/img/TrackingLocationMask@2x.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationMask@3x.png b/ios/app/img/TrackingLocationMask@3x.png
new file mode 100644
index 0000000000..af523975a5
--- /dev/null
+++ b/ios/app/img/TrackingLocationMask@3x.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationOffMask.png b/ios/app/img/TrackingLocationOffMask.png
new file mode 100644
index 0000000000..87b26c5710
--- /dev/null
+++ b/ios/app/img/TrackingLocationOffMask.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationOffMask@2x.png b/ios/app/img/TrackingLocationOffMask@2x.png
new file mode 100644
index 0000000000..232d534b41
--- /dev/null
+++ b/ios/app/img/TrackingLocationOffMask@2x.png
Binary files differ
diff --git a/ios/app/img/TrackingLocationOffMask@3x.png b/ios/app/img/TrackingLocationOffMask@3x.png
new file mode 100644
index 0000000000..b609fbe84e
--- /dev/null
+++ b/ios/app/img/TrackingLocationOffMask@3x.png
Binary files differ
diff --git a/ios/app/img/locateUser.png b/ios/app/img/locateUser.png
deleted file mode 100644
index aa8d1cf52e..0000000000
--- a/ios/app/img/locateUser.png
+++ /dev/null
Binary files differ
diff --git a/ios/app/img/locateUser@2x.png b/ios/app/img/locateUser@2x.png
deleted file mode 100644
index 29c4905938..0000000000
--- a/ios/app/img/locateUser@2x.png
+++ /dev/null
Binary files differ
diff --git a/ios/app/img/locateUser@3x.png b/ios/app/img/locateUser@3x.png
deleted file mode 100644
index 206a5ae80f..0000000000
--- a/ios/app/img/locateUser@3x.png
+++ /dev/null
Binary files differ