diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-04-09 09:56:01 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-04-09 09:56:01 -0700 |
commit | fc3802eddb679c040b7faaac0dc1b096cbc940a7 (patch) | |
tree | 4f3ba3fc27dd4b22e29db2e8757be8cc8ad3167b /ios | |
parent | c0eee9565ed9f521136be7a145a34caf0a5e1dd2 (diff) | |
parent | be599fa385baf2bedd2d788737282c84d8737a0f (diff) | |
download | qtlocation-mapboxgl-fc3802eddb679c040b7faaac0dc1b096cbc940a7.tar.gz |
Merge pull request #1239 from friedbunny/locate-button
Add simple tracking mode button to demo app
Diffstat (limited to 'ios')
-rw-r--r-- | ios/app/MBXViewController.mm | 25 | ||||
-rw-r--r-- | ios/app/img/TrackingHeadingMask.png | bin | 0 -> 250 bytes | |||
-rw-r--r-- | ios/app/img/TrackingHeadingMask@2x.png | bin | 0 -> 467 bytes | |||
-rw-r--r-- | ios/app/img/TrackingHeadingMask@3x.png | bin | 0 -> 672 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationMask.png | bin | 0 -> 407 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationMask@2x.png | bin | 0 -> 680 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationMask@3x.png | bin | 0 -> 903 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationOffMask.png | bin | 0 -> 493 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationOffMask@2x.png | bin | 0 -> 973 bytes | |||
-rw-r--r-- | ios/app/img/TrackingLocationOffMask@3x.png | bin | 0 -> 1407 bytes | |||
-rw-r--r-- | ios/app/img/locateUser.png | bin | 1111 -> 0 bytes | |||
-rw-r--r-- | ios/app/img/locateUser@2x.png | bin | 1696 -> 0 bytes | |||
-rw-r--r-- | ios/app/img/locateUser@3x.png | bin | 521 -> 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 Binary files differnew file mode 100644 index 0000000000..9ec0567a3f --- /dev/null +++ b/ios/app/img/TrackingHeadingMask.png diff --git a/ios/app/img/TrackingHeadingMask@2x.png b/ios/app/img/TrackingHeadingMask@2x.png Binary files differnew file mode 100644 index 0000000000..0df8ccc229 --- /dev/null +++ b/ios/app/img/TrackingHeadingMask@2x.png diff --git a/ios/app/img/TrackingHeadingMask@3x.png b/ios/app/img/TrackingHeadingMask@3x.png Binary files differnew file mode 100644 index 0000000000..e4b93e42e7 --- /dev/null +++ b/ios/app/img/TrackingHeadingMask@3x.png diff --git a/ios/app/img/TrackingLocationMask.png b/ios/app/img/TrackingLocationMask.png Binary files differnew file mode 100644 index 0000000000..bb7348c482 --- /dev/null +++ b/ios/app/img/TrackingLocationMask.png diff --git a/ios/app/img/TrackingLocationMask@2x.png b/ios/app/img/TrackingLocationMask@2x.png Binary files differnew file mode 100644 index 0000000000..35c5a293ec --- /dev/null +++ b/ios/app/img/TrackingLocationMask@2x.png diff --git a/ios/app/img/TrackingLocationMask@3x.png b/ios/app/img/TrackingLocationMask@3x.png Binary files differnew file mode 100644 index 0000000000..af523975a5 --- /dev/null +++ b/ios/app/img/TrackingLocationMask@3x.png diff --git a/ios/app/img/TrackingLocationOffMask.png b/ios/app/img/TrackingLocationOffMask.png Binary files differnew file mode 100644 index 0000000000..87b26c5710 --- /dev/null +++ b/ios/app/img/TrackingLocationOffMask.png diff --git a/ios/app/img/TrackingLocationOffMask@2x.png b/ios/app/img/TrackingLocationOffMask@2x.png Binary files differnew file mode 100644 index 0000000000..232d534b41 --- /dev/null +++ b/ios/app/img/TrackingLocationOffMask@2x.png diff --git a/ios/app/img/TrackingLocationOffMask@3x.png b/ios/app/img/TrackingLocationOffMask@3x.png Binary files differnew file mode 100644 index 0000000000..b609fbe84e --- /dev/null +++ b/ios/app/img/TrackingLocationOffMask@3x.png diff --git a/ios/app/img/locateUser.png b/ios/app/img/locateUser.png Binary files differdeleted file mode 100644 index aa8d1cf52e..0000000000 --- a/ios/app/img/locateUser.png +++ /dev/null diff --git a/ios/app/img/locateUser@2x.png b/ios/app/img/locateUser@2x.png Binary files differdeleted file mode 100644 index 29c4905938..0000000000 --- a/ios/app/img/locateUser@2x.png +++ /dev/null diff --git a/ios/app/img/locateUser@3x.png b/ios/app/img/locateUser@3x.png Binary files differdeleted file mode 100644 index 206a5ae80f..0000000000 --- a/ios/app/img/locateUser@3x.png +++ /dev/null |