diff options
author | Jason Wray <jason@mapbox.com> | 2017-08-01 18:55:04 -0400 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-08-02 18:48:11 -0400 |
commit | a0402475052b1fd29b107aca5bbe9074fadc2cb9 (patch) | |
tree | 82e5cb18c5a414d9afa4fcee54007b049e31cee9 /platform/ios | |
parent | 55d31922fcd47947b17261177e6d91201fe7c02a (diff) | |
download | qtlocation-mapboxgl-a0402475052b1fd29b107aca5bbe9074fadc2cb9.tar.gz |
[ios] Clean-up iosapp project
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/app/Default-568h@2x.png | bin | 18594 -> 0 bytes | |||
-rw-r--r-- | platform/ios/app/LaunchScreen.storyboard | 14 | ||||
-rw-r--r-- | platform/ios/app/MBXViewController.m | 181 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 26 |
4 files changed, 114 insertions, 107 deletions
diff --git a/platform/ios/app/Default-568h@2x.png b/platform/ios/app/Default-568h@2x.png Binary files differdeleted file mode 100644 index 0891b7aabf..0000000000 --- a/platform/ios/app/Default-568h@2x.png +++ /dev/null diff --git a/platform/ios/app/LaunchScreen.storyboard b/platform/ios/app/LaunchScreen.storyboard index 323bd43177..299e186886 100644 --- a/platform/ios/app/LaunchScreen.storyboard +++ b/platform/ios/app/LaunchScreen.storyboard @@ -1,8 +1,12 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--View Controller--> @@ -14,9 +18,9 @@ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </view> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index b6b9eea7db..992b7d587a 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -34,7 +34,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsCoreRenderingRows) { MBXSettingsCoreRenderingTimestamps, MBXSettingsCoreRenderingCollisionBoxes, MBXSettingsCoreRenderingOverdrawVisualization, - MBXSettingsCoreRenderingToggleTwoMaps, }; typedef NS_ENUM(NSInteger, MBXSettingsAnnotationsRows) { @@ -48,6 +47,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsAnnotationsRows) { MBXSettingsAnnotationsTestShapes, MBXSettingsAnnotationsCustomCallout, MBXSettingsAnnotationsQueryAnnotations, + MBXSettingsAnnotationsCustomUserDot, MBXSettingsAnnotationsRemoveAnnotations, }; @@ -71,7 +71,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) { MBXSettingsRuntimeStylingUpdateShapeSourceFeatures, MBXSettingsRuntimeStylingVectorSource, MBXSettingsRuntimeStylingRasterSource, - MBXSettingsRuntimeStylingCountryLabels, MBXSettingsRuntimeStylingRouteLine, MBXSettingsRuntimeStylingDDSPolygon, }; @@ -79,9 +78,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) { typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MBXSettingsMiscellaneousShowReuseQueueStats = 0, MBXSettingsMiscellaneousWorldTour, - MBXSettingsMiscellaneousCustomUserDot, MBXSettingsMiscellaneousShowZoomLevel, MBXSettingsMiscellaneousScrollView, + MBXSettingsMiscellaneousToggleTwoMaps, + MBXSettingsMiscellaneousCountryLabels, MBXSettingsMiscellaneousPrintLogFile, MBXSettingsMiscellaneousDeleteLogFile, }; @@ -303,8 +303,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { (debugMask & MGLMapDebugCollisionBoxesMask ? @"Hide" :@"Show")], [NSString stringWithFormat:@"%@ Overdraw Visualization", (debugMask & MGLMapDebugOverdrawVisualizationMask ? @"Hide" :@"Show")], - [NSString stringWithFormat:@"%@ Second Map", - ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")], ]]; break; case MBXSettingsAnnotations: @@ -319,6 +317,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @"Add Test Shapes", @"Add Point With Custom Callout", @"Query Annotations", + [NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")], @"Remove Annotations", ]]; break; @@ -343,7 +342,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @"Update Shape Source: Features", @"Style Vector Source", @"Style Raster Source", - [NSString stringWithFormat:@"Show Labels in %@", (_usingLocaleBasedCountryLabels ? @"Local Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], @"Add Route Line", @"Dynamically Style Polygon", ]]; @@ -352,9 +350,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [settingsTitles addObjectsFromArray:@[ [NSString stringWithFormat:@"%@ Reuse Queue Stats", (_reuseQueueStatsEnabled ? @"Hide" :@"Show")], @"Start World Tour", - [NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")], [NSString stringWithFormat:@"%@ Zoom Level", (_showZoomLevelEnabled ? @"Hide" :@"Show")], @"Embedded Map View", + [NSString stringWithFormat:@"%@ Second Map", ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")], + [NSString stringWithFormat:@"Show Labels in %@", (_usingLocaleBasedCountryLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], ]]; if (self.debugLoggingEnabled) @@ -399,81 +398,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { case MBXSettingsCoreRenderingOverdrawVisualization: self.mapView.debugMask ^= MGLMapDebugOverdrawVisualizationMask; break; - case MBXSettingsCoreRenderingToggleTwoMaps: - if ([self.view viewWithTag:2] == nil) { - MGLMapView *secondMapView = [[MGLMapView alloc] initWithFrame: - CGRectMake(0, self.view.bounds.size.height / 2, - self.view.bounds.size.width, self.view.bounds.size.height / 2)]; - secondMapView.translatesAutoresizingMaskIntoConstraints = false; - secondMapView.tag = 2; - for (NSLayoutConstraint *constraint in self.view.constraints) - { - if ((constraint.firstItem == self.mapView && constraint.firstAttribute == NSLayoutAttributeBottom) || - (constraint.secondItem == self.mapView && constraint.secondAttribute == NSLayoutAttributeBottom)) - { - [self.view removeConstraint:constraint]; - break; - } - } - [self.view addSubview:secondMapView]; - [self.view addConstraints:@[ - [NSLayoutConstraint constraintWithItem:self.mapView - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeCenterY - multiplier:1 - constant:0], - [NSLayoutConstraint constraintWithItem:secondMapView - attribute:NSLayoutAttributeCenterX - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeCenterX - multiplier:1 - constant:0], - [NSLayoutConstraint constraintWithItem:secondMapView - attribute:NSLayoutAttributeWidth - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeWidth - multiplier:1 - constant:0], - [NSLayoutConstraint constraintWithItem:secondMapView - attribute:NSLayoutAttributeTop - relatedBy:NSLayoutRelationEqual - toItem:self.view - attribute:NSLayoutAttributeCenterY - multiplier:1 - constant:0], - [NSLayoutConstraint constraintWithItem:secondMapView - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.bottomLayoutGuide - attribute:NSLayoutAttributeTop - multiplier:1 - constant:0], - ]]; - } else { - NSMutableArray *constraintsToRemove = [NSMutableArray array]; - MGLMapView *secondMapView = (MGLMapView *)[self.view viewWithTag:2]; - for (NSLayoutConstraint *constraint in self.view.constraints) - { - if (constraint.firstItem == secondMapView || constraint.secondItem == secondMapView) - { - [constraintsToRemove addObject:constraint]; - } - } - [self.view removeConstraints:constraintsToRemove]; - [secondMapView removeFromSuperview]; - [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.mapView - attribute:NSLayoutAttributeBottom - relatedBy:NSLayoutRelationEqual - toItem:self.bottomLayoutGuide - attribute:NSLayoutAttributeTop - multiplier:1 - constant:0]]; - } - break; default: NSAssert(NO, @"All core rendering setting rows should be implemented"); break; @@ -512,6 +436,9 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { case MBXSettingsAnnotationsQueryAnnotations: [self testQueryPointAnnotations]; break; + case MBXSettingsAnnotationsCustomUserDot: + [self toggleCustomUserDot]; + break; case MBXSettingsAnnotationsRemoveAnnotations: [self.mapView removeAnnotations:self.mapView.annotations]; break; @@ -580,9 +507,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { case MBXSettingsRuntimeStylingRasterSource: [self styleRasterSource]; break; - case MBXSettingsRuntimeStylingCountryLabels: - [self styleCountryLabelsLanguage]; - break; case MBXSettingsRuntimeStylingRouteLine: [self styleRouteLine]; break; @@ -597,12 +521,12 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { case MBXSettingsMiscellaneous: switch (indexPath.row) { + case MBXSettingsMiscellaneousCountryLabels: + [self styleCountryLabelsLanguage]; + break; case MBXSettingsMiscellaneousWorldTour: [self startWorldTour]; break; - case MBXSettingsMiscellaneousCustomUserDot: - [self toggleCustomUserDot]; - break; case MBXSettingsMiscellaneousPrintLogFile: [self printTelemetryLogFile]; break; @@ -630,6 +554,81 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [self.navigationController pushViewController:embeddedMapViewController animated:YES]; break; } + case MBXSettingsMiscellaneousToggleTwoMaps: + if ([self.view viewWithTag:2] == nil) { + MGLMapView *secondMapView = [[MGLMapView alloc] initWithFrame: + CGRectMake(0, self.view.bounds.size.height / 2, + self.view.bounds.size.width, self.view.bounds.size.height / 2)]; + secondMapView.translatesAutoresizingMaskIntoConstraints = false; + secondMapView.tag = 2; + for (NSLayoutConstraint *constraint in self.view.constraints) + { + if ((constraint.firstItem == self.mapView && constraint.firstAttribute == NSLayoutAttributeBottom) || + (constraint.secondItem == self.mapView && constraint.secondAttribute == NSLayoutAttributeBottom)) + { + [self.view removeConstraint:constraint]; + break; + } + } + [self.view addSubview:secondMapView]; + [self.view addConstraints:@[ + [NSLayoutConstraint constraintWithItem:self.mapView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0], + [NSLayoutConstraint constraintWithItem:secondMapView + attribute:NSLayoutAttributeCenterX + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeCenterX + multiplier:1 + constant:0], + [NSLayoutConstraint constraintWithItem:secondMapView + attribute:NSLayoutAttributeWidth + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeWidth + multiplier:1 + constant:0], + [NSLayoutConstraint constraintWithItem:secondMapView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self.view + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0], + [NSLayoutConstraint constraintWithItem:secondMapView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.bottomLayoutGuide + attribute:NSLayoutAttributeTop + multiplier:1 + constant:0], + ]]; + } else { + NSMutableArray *constraintsToRemove = [NSMutableArray array]; + MGLMapView *secondMapView = (MGLMapView *)[self.view viewWithTag:2]; + for (NSLayoutConstraint *constraint in self.view.constraints) + { + if (constraint.firstItem == secondMapView || constraint.secondItem == secondMapView) + { + [constraintsToRemove addObject:constraint]; + } + } + [self.view removeConstraints:constraintsToRemove]; + [secondMapView removeFromSuperview]; + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.mapView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self.bottomLayoutGuide + attribute:NSLayoutAttributeTop + multiplier:1 + constant:0]]; + } + break; default: NSAssert(NO, @"All miscellaneous setting rows should be implemented"); break; @@ -1261,8 +1260,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)styleRasterSource { - NSArray *tileURLTemplates = @[@"https://stamen-tiles.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}.jpg"]; - MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"style-raster-source-id" tileURLTemplates:tileURLTemplates options:@{ + NSString *tileURL = [NSString stringWithFormat:@"https://stamen-tiles.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}%@.jpg", UIScreen.mainScreen.nativeScale > 1 ? @"@2x" : @""]; + MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"style-raster-source-id" tileURLTemplates:@[tileURL] options:@{ MGLTileSourceOptionTileSize: @256, }]; [self.mapView.style addSource:rasterSource]; @@ -1574,7 +1573,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [sender setAccessibilityValue:nextAccessibilityValue]; } -#pragma mark - Map Delegate +#pragma mark - MGLMapViewDelegate - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation { diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 83b267df43..76b35be2de 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -233,7 +233,6 @@ DA1DC9971CB6E046006E619F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC9961CB6E046006E619F /* main.m */; }; DA1DC9991CB6E054006E619F /* MBXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC9981CB6E054006E619F /* MBXAppDelegate.m */; }; DA1DC99B1CB6E064006E619F /* MBXViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC99A1CB6E064006E619F /* MBXViewController.m */; }; - DA1DC99D1CB6E076006E619F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */; }; DA1DC99F1CB6E088006E619F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC99E1CB6E088006E619F /* Assets.xcassets */; }; DA1F8F3D1EBD287B00367E42 /* MGLDocumentationGuideTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1F8F3C1EBD287B00367E42 /* MGLDocumentationGuideTests.swift */; }; DA2207BF1DC0805F0002F84D /* MGLStyleValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2207BE1DC0805F0002F84D /* MGLStyleValueTests.swift */; }; @@ -718,7 +717,6 @@ DA1DC9961CB6E046006E619F /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; DA1DC9981CB6E054006E619F /* MBXAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXAppDelegate.m; sourceTree = "<group>"; }; DA1DC99A1CB6E064006E619F /* MBXViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXViewController.m; sourceTree = "<group>"; }; - DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; }; DA1DC99E1CB6E088006E619F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; DA1F8F3C1EBD287B00367E42 /* MGLDocumentationGuideTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLDocumentationGuideTests.swift; path = ../../darwin/test/MGLDocumentationGuideTests.swift; sourceTree = "<group>"; }; DA2207BE1DC0805F0002F84D /* MGLStyleValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLStyleValueTests.swift; path = ../../darwin/test/MGLStyleValueTests.swift; sourceTree = "<group>"; }; @@ -1154,6 +1152,20 @@ name = Sources; sourceTree = "<group>"; }; + 9604FC341F313A5E003EEA02 /* Fixtures */ = { + isa = PBXGroup; + children = ( + 353BAEF51D646370009A8DA9 /* amsterdam.geojson */, + DA1DC96C1CB6C6CE006E619F /* points.geojson */, + DA1DC96D1CB6C6CE006E619F /* polyline.geojson */, + DA1DC96F1CB6C6CE006E619F /* threestates.geojson */, + DD4823721D94AE6C00EB71B7 /* fill_filter_style.json */, + DD4823731D94AE6C00EB71B7 /* line_filter_style.json */, + DD4823741D94AE6C00EB71B7 /* numeric_filter_style.json */, + ); + name = Fixtures; + sourceTree = "<group>"; + }; DA1DC9411CB6C1C2006E619F = { isa = PBXGroup; children = ( @@ -1202,16 +1214,9 @@ DA821D051CCC6D59007508D4 /* Main.storyboard */, DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */, DA1DC99E1CB6E088006E619F /* Assets.xcassets */, - DA1DC96C1CB6C6CE006E619F /* points.geojson */, - DA1DC96D1CB6C6CE006E619F /* polyline.geojson */, - DA1DC96F1CB6C6CE006E619F /* threestates.geojson */, - 353BAEF51D646370009A8DA9 /* amsterdam.geojson */, - DD4823721D94AE6C00EB71B7 /* fill_filter_style.json */, - DD4823731D94AE6C00EB71B7 /* line_filter_style.json */, - DD4823741D94AE6C00EB71B7 /* numeric_filter_style.json */, DA1DC95E1CB6C1C2006E619F /* Info.plist */, - DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */, 96E027251E57C76E004B8E66 /* Localizable.strings */, + 9604FC341F313A5E003EEA02 /* Fixtures */, DA1DC94D1CB6C1C2006E619F /* Supporting Files */, ); name = "Demo App"; @@ -2056,7 +2061,6 @@ 353BAEF61D646370009A8DA9 /* amsterdam.geojson in Resources */, DA1DC9711CB6C6CE006E619F /* polyline.geojson in Resources */, DD4823761D94AE6C00EB71B7 /* line_filter_style.json in Resources */, - DA1DC99D1CB6E076006E619F /* Default-568h@2x.png in Resources */, DA821D071CCC6D59007508D4 /* Main.storyboard in Resources */, DA1DC9731CB6C6CE006E619F /* threestates.geojson in Resources */, DA821D061CCC6D59007508D4 /* LaunchScreen.storyboard in Resources */, |