diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-04-26 10:36:57 -0700 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-04-26 10:36:57 -0700 |
commit | 349dff31d076428919f3dc24f56d1dbe05b136db (patch) | |
tree | 070d5d829d4b75c90dbb8ba709a0e258a6b8f395 | |
parent | ab2aa7fdb7589ec5d8e31f10fa20c28039e9eefc (diff) | |
download | qtlocation-mapboxgl-349dff31d076428919f3dc24f56d1dbe05b136db.tar.gz |
[ios] update annotation view color
-rw-r--r-- | platform/ios/app/MBXViewController.m | 31 | ||||
-rw-r--r-- | platform/ios/app/Main.storyboard | 11 |
2 files changed, 24 insertions, 18 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index f421266d44..499cf2abc4 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -107,7 +107,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MBXSettingsMiscellaneousShouldLimitCameraChanges, MBXSettingsMiscellaneousShowCustomLocationManager, MBXSettingsMiscellaneousOrnamentsPlacement, - MBXSettingsMiscellaneousModalView, MBXSettingsMiscellaneousPrintLogFile, MBXSettingsMiscellaneousDeleteLogFile }; @@ -210,7 +209,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { @property (nonatomic) BOOL shouldLimitCameraChanges; @property (nonatomic) BOOL randomWalk; @property (nonatomic) NSMutableArray<UIWindow *> *helperWindows; - +@property (nonatomic) BOOL addedAnnotation; @end @interface MGLMapView (MBXViewController) @@ -320,6 +319,8 @@ CLLocationCoordinate2D randomWorldCoordinate() { } } }]; + [self parseFeaturesAddingCount:1000 usingViews:YES]; + self.addedAnnotation = NO; } - (void)saveState:(__unused NSNotification *)notification @@ -505,7 +506,6 @@ CLLocationCoordinate2D randomWorldCoordinate() { [NSString stringWithFormat:@"%@ Camera Changes", (_shouldLimitCameraChanges ? @"Unlimit" : @"Limit")], @"View Route Simulation", @"Ornaments Placement", - @"Present Modal View", ]]; if (self.debugLoggingEnabled) @@ -774,11 +774,6 @@ CLLocationCoordinate2D randomWorldCoordinate() { [self.navigationController pushViewController:ornamentsViewController animated:YES]; break; } - case MBXSettingsMiscellaneousModalView: - { - [self presentModalVCOverMapView]; - break; - } default: NSAssert(NO, @"All miscellaneous setting rows should be implemented"); break; @@ -1207,6 +1202,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { }); } + - (void)styleQuery { CGRect queryRect = CGRectInset(self.mapView.bounds, 100, 200); @@ -2249,14 +2245,19 @@ CLLocationCoordinate2D randomWorldCoordinate() { _localizingLabels = [[self bestLanguageForUser] isEqualToString:@"en"]; } -- (void)presentModalVCOverMapView { - [self parseFeaturesAddingCount:100 usingViews:YES]; - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; - UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"TestViewController"]; - [self.navigationController presentViewController:vc animated:YES completion:nil]; - +- (IBAction)toggleTestAnnotation:(id)sender { + NSUInteger i = arc4random_uniform((uint32_t)[self.mapView.visibleAnnotations count]); + [self.mapView selectAnnotation:self.mapView.visibleAnnotations[i] moveIntoView:NO animateSelection:NO]; } +- (void)mapView:(MGLMapView *)mapView didSelectAnnotationView:(MGLAnnotationView *)annotationView { + if (!self.addedAnnotation) { + annotationView.backgroundColor = [UIColor purpleColor]; + } else { + annotationView.backgroundColor = [UIColor greenColor]; + } + self.addedAnnotation = !self.addedAnnotation; +} - (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera { if (_shouldLimitCameraChanges) { // Get the current camera to restore it after. @@ -2293,7 +2294,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { if (reason != MGLCameraChangeReasonProgrammatic) { self.randomWalk = NO; } - + [self updateHUD]; [self updateHelperMapViews]; } diff --git a/platform/ios/app/Main.storyboard b/platform/ios/app/Main.storyboard index 9acd874a85..d92761f4bb 100644 --- a/platform/ios/app/Main.storyboard +++ b/platform/ios/app/Main.storyboard @@ -86,14 +86,19 @@ <action selector="showSettings:" destination="WaX-pd-UZQ" id="X2C-Ee-Qvt"/> </connections> </barButtonItem> - <barButtonItem title="Item" id="1Cm-ct-O5U"> + <barButtonItem title="Modal VC" id="1Cm-ct-O5U"> <connections> <segue destination="GJx-bG-Csz" kind="presentation" id="26R-NA-y08"/> </connections> </barButtonItem> + <barButtonItem title="+/-" id="KhU-cX-Fxj"> + <connections> + <action selector="toggleTestAnnotation:" destination="WaX-pd-UZQ" id="Fri-qB-x7v"/> + </connections> + </barButtonItem> </leftBarButtonItems> - <button key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="KsN-ny-Hou"> - <rect key="frame" x="94" y="5.5" width="181" height="33"/> + <button key="titleView" opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="KsN-ny-Hou"> + <rect key="frame" x="169" y="5.5" width="106" height="33"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> <state key="normal" title="Streets"/> |